mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-29 22:51:33 +02:00
Die quietly if exec() fails
This commit is contained in:
parent
3bf3086a29
commit
5b2858e6d6
@ -16,6 +16,7 @@ mod imp {
|
|||||||
pub fn new(cmd: &str, updated_paths: Vec<PathBuf>) -> Result<Process> {
|
pub fn new(cmd: &str, updated_paths: Vec<PathBuf>) -> Result<Process> {
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::os::unix::process::CommandExt;
|
use std::os::unix::process::CommandExt;
|
||||||
|
use libc::exit;
|
||||||
use nix::unistd::*;
|
use nix::unistd::*;
|
||||||
|
|
||||||
let mut command = Command::new("sh");
|
let mut command = Command::new("sh");
|
||||||
@ -42,9 +43,12 @@ mod imp {
|
|||||||
},
|
},
|
||||||
Ok(ForkResult::Child) => {
|
Ok(ForkResult::Child) => {
|
||||||
let _ = setpgid(0, 0);
|
let _ = setpgid(0, 0);
|
||||||
let e = command.exec();
|
let _ = command.exec();
|
||||||
|
|
||||||
Err(e)
|
// If we get here, there isn't much we can do
|
||||||
|
unsafe {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => { Err(io::Error::from(e)) }
|
Err(e) => { Err(io::Error::from(e)) }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user