Skip to main content

spawn_daemon

Function spawn_daemon 

Source
pub fn spawn_daemon(command: &mut Command) -> Result<DaemonChild>
Expand description

Spawn command as a detached daemon. NUL stdio, sanitized handles, no console window, ignores parent’s Ctrl-C / SIGINT (Windows: CREATE_NEW_PROCESS_GROUP + DETACHED_PROCESS; Unix: setsid puts the daemon in a new session so it’s not in the parent’s foreground group).

The NUL-stdio guarantee is enforced internally by the platform impls and is not configurable — a detached daemon needs sunk stdio to avoid crashing on later println!/eprintln! after the parent closes its handles.