Add command exit code to output if it fails

This commit is contained in:
Julian Kaindl 2020-10-25 19:04:17 +01:00 committed by GitHub
parent 990ed45c3a
commit c05d7f9480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,7 @@
# unreleased
- Add command exit code to output if it fails, see #342 (@KaindlJulian)
## Features
## Changes

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. \
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)
)
),
));
}