Skip to content

Commit 907136d

Browse files
authored
Merge pull request #6 from bobrik/ivan/pre-new-process
Add LifecycleHandler::pre_new_process
2 parents 40fc0fd + aa50d0b commit 907136d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@ async fn spawn_child(
412412
user_envs: &[(OsString, OsString)],
413413
lifecycle_handler: &mut dyn LifecycleHandler,
414414
) -> io::Result<process::Child> {
415+
lifecycle_handler.pre_new_process().await;
416+
415417
let mut args = env::args();
416418
let process_name = args.next().unwrap();
417419

src/lifecycle.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ pub trait LifecycleHandler: Send {
1919
Ok(())
2020
}
2121

22+
/// Called before the child process has been spawned.
23+
async fn pre_new_process(&mut self) {}
24+
2225
/// Called after `send_to_new_process` if the child process fails to start successfully.
2326
/// This gives you an opportunity to undo any state changes made in `send_to_new_process`.
2427
async fn new_process_failed(&mut self) {}

0 commit comments

Comments
 (0)