From 5b2858e6d67e13105dbfe11cb58cef2b3fa619a8 Mon Sep 17 00:00:00 2001 From: Matt Green Date: Tue, 15 Nov 2016 17:04:15 -0500 Subject: [PATCH] Die quietly if exec() fails --- src/process.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/process.rs b/src/process.rs index c673b53c..3f85e02b 100644 --- a/src/process.rs +++ b/src/process.rs @@ -16,6 +16,7 @@ mod imp { pub fn new(cmd: &str, updated_paths: Vec) -> Result { use std::io; use std::os::unix::process::CommandExt; + use libc::exit; use nix::unistd::*; let mut command = Command::new("sh"); @@ -42,9 +43,12 @@ mod imp { }, Ok(ForkResult::Child) => { 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)) } }