diff --git a/crates/plano-cli/src/native/runner.rs b/crates/plano-cli/src/native/runner.rs index 3f1bbe00..61d44a3d 100644 --- a/crates/plano-cli/src/native/runner.rs +++ b/crates/plano-cli/src/native/runner.rs @@ -313,8 +313,9 @@ pub async fn start_native( Ok(()) } -/// Double-fork daemon execution. Returns the grandchild PID. +/// Spawn a detached daemon process. Returns the child PID. fn daemon_exec(args: &[String], env: &HashMap, log_path: &Path) -> Result { + use std::os::unix::process::CommandExt; use std::process::{Command, Stdio}; let log_file = fs::File::create(log_path)?; @@ -325,6 +326,7 @@ fn daemon_exec(args: &[String], env: &HashMap, log_path: &Path) .stdin(Stdio::null()) .stdout(log_file.try_clone()?) .stderr(log_file) + .process_group(0) // detach from parent's process group .spawn()?; Ok(child.id() as i32)