diff options
author | Yoichi NAKAYAMA <yoichi.nakayama@gmail.com> | 2020-10-01 22:23:38 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 09:23:38 -0400 |
commit | b920752c1d333d84a8e98d64ed989613709063f0 (patch) | |
tree | 327f02e008a43b8446ccd74352203438d0ecdc54 | |
parent | 42bfff5a4dbaaf466b083dae137efb1dc4518410 (diff) |
Handle diff execution error gracefully. (#341)
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index d2937854..9a93ecdd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,12 +109,16 @@ fn diff( plus_file.unwrap_or_else(die), ]) .stdout(process::Stdio::piped()) - .spawn(); + .spawn() + .unwrap_or_else(|err| { + eprintln!("Failed to execute the command: diff: {}", err); + process::exit(1); + }); let mut output_type = OutputType::from_mode(config.paging_mode, None, &config).unwrap(); let mut writer = output_type.handle().unwrap(); if let Err(error) = delta( - BufReader::new(diff_process.unwrap().stdout.unwrap()).byte_lines(), + BufReader::new(diff_process.stdout.unwrap()).byte_lines(), &mut writer, &config, ) { |