Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ async fn spawn_child(
user_envs: &[(OsString, OsString)],
lifecycle_handler: &mut dyn LifecycleHandler,
) -> io::Result<process::Child> {
lifecycle_handler.pre_new_process().await;

let mut args = env::args();
let process_name = args.next().unwrap();

Expand Down
3 changes: 3 additions & 0 deletions src/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ pub trait LifecycleHandler: Send {
Ok(())
}

/// Called before the child process has been spawned.
async fn pre_new_process(&mut self) {}

/// Called after `send_to_new_process` if the child process fails to start successfully.
/// This gives you an opportunity to undo any state changes made in `send_to_new_process`.
async fn new_process_failed(&mut self) {}
Expand Down