summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2017-11-15 23:24:11 +0100
committersharkdp <davidpeter@web.de>2017-11-15 23:24:11 +0100
commit5ed751409679f0c1379acee3a0868e3071b6b6b2 (patch)
treecfddc9eea7dd6b6fbbf53af926eedd7418a2bd44
parent3c5d8a1e86c319e2f63967a7fd47cd04b9deed42 (diff)
Update error message if command could not be found
-rw-r--r--src/exec/command.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/exec/command.rs b/src/exec/command.rs
index 1338f0d..28b8998 100644
--- a/src/exec/command.rs
+++ b/src/exec/command.rs
@@ -32,7 +32,13 @@ pub fn execute_command(mut cmd: Command, out_perm: Arc<Mutex<()>>) {
let _ = stdout.lock().write_all(&output.stdout);
let _ = stderr.lock().write_all(&output.stderr);
}
- Err(why) => eprintln!("fd: exec error: {}", why),
+ Err(why) => {
+ if why.kind() == io::ErrorKind::NotFound {
+ eprintln!("fd: execution error: command not found");
+ } else {
+ eprintln!("fd: execution error: {}", why);
+ }
+ }
}
}
@@ -93,6 +99,12 @@ pub fn execute_command(mut cmd: Command, out_perm: Arc<Mutex<()>>) {
let _ = io::copy(&mut pout, &mut stdout.lock());
let _ = io::copy(&mut perr, &mut stderr.lock());
}
- Err(why) => eprintln!("fd: exec error: {}", why),
+ Err(why) => {
+ if why.kind() == io::ErrorKind::NotFound {
+ eprintln!("fd: execution error: command not found");
+ } else {
+ eprintln!("fd: execution error: {}", why);
+ }
+ }
}
}