init: Add a nowait command that immediately daemonizes

This is useful for daemons on which no other daemon has a dependency as
those would no longer need to use redox_daemon to daemonize themself.
This commit is contained in:
bjorn3
2025-11-30 10:05:18 +01:00
parent ff578463cb
commit 66ca17f899
+16
View File
@@ -179,6 +179,22 @@ pub fn run(file: &Path) -> Result<()> {
env::remove_var(&arg);
}
}
"nowait" => {
if let Some(cmd) = args.next() {
let mut command = Command::new(cmd);
for arg in args {
command.arg(arg);
}
match command.spawn() {
Ok(_child) => {}
Err(err) => println!("init: failed to execute '{}': {}", line, err),
}
} else {
println!("init: failed to run nowait: no argument");
}
}
_ => {
let mut command = Command::new(cmd.clone());
for arg in args {