exit with non-zero exit code when script ends with non-zero exit (#6115)

This commit is contained in:
JT 2022-07-25 10:57:10 +12:00 committed by GitHub
parent 10536f70f3
commit 46f64c6fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -299,6 +299,16 @@ fn main() -> Result<()> {
input,
is_perf_true(),
);
let last_exit_code = stack.get_env_var(&engine_state, "LAST_EXIT_CODE");
if let Some(last_exit_code) = last_exit_code {
let value = last_exit_code.as_integer();
if let Ok(value) = value {
if value != 0 {
std::process::exit(value as i32);
}
}
}
if is_perf_true() {
info!("eval_file execution {}:{}:{}", file!(), line!(), column!());
}