Fix return setting last exit code (#14120)

# Description

Fixes #14113 and #14112.

# Tests + Formatting

Added a test.
This commit is contained in:
Ian Manske
2024-10-17 20:05:58 -07:00
committed by GitHub
parent 28b6db115a
commit e911ff4d67
5 changed files with 16 additions and 7 deletions

View File

@ -104,7 +104,7 @@ pub(crate) fn run_commands(
if let Err(err) = result {
report_shell_error(engine_state, &err);
std::process::exit(err.exit_code());
std::process::exit(err.exit_code().unwrap_or(0));
}
}
@ -178,7 +178,7 @@ pub(crate) fn run_file(
if let Err(err) = result {
report_shell_error(engine_state, &err);
std::process::exit(err.exit_code());
std::process::exit(err.exit_code().unwrap_or(0));
}
}