Add command exit code to output if it fails

This commit is contained in:
Julian Kaindl authored and GitHub committed 2020-10-25 19:04:17 +01:00
1 parent 990ed45c3a
commit c05d7f9480
2 files changed
+11 -3

No files matched your search

+2
View File
@@ -1,5 +1,7 @@
# unreleased
- Add command exit code to output if it fails, see #342 (@KaindlJulian)
## Features
## Changes
+9 -3
View File
@@ -63,9 +63,15 @@ pub fn time_shell_command(
if failure_action == CmdFailureAction::RaiseError && !result.status.success() {
return Err(io::Error::new(
io::ErrorKind::Other,
"Command terminated with non-zero exit code. \
Use the '-i'/'--ignore-failure' option if you want to ignore this. \
Alternatively, use the '--show-output' option to debug what went wrong.",
format!(
"{}. \
Use the '-i'/'--ignore-failure' option if you want to ignore this. \
Alternatively, use the '--show-output' option to debug what went wrong.",
result.status.code().map_or(
"The process has been terminated by a signal".into(),
|c| format!("Command terminated with non-zero exit code: {}", c)
)
),
));
}