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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user