summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorYoichi NAKAYAMA <yoichi.nakayama@gmail.com>2020-10-01 22:23:38 +0900
committerGitHub <noreply@github.com>2020-10-01 09:23:38 -0400
commitb920752c1d333d84a8e98d64ed989613709063f0 (patch)
tree327f02e008a43b8446ccd74352203438d0ecdc54 /src/main.rs
parent42bfff5a4dbaaf466b083dae137efb1dc4518410 (diff)
Handle diff execution error gracefully. (#341)
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs8
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,
) {