forked from extern/nushell
exit with non-zero exit code when script ends with non-zero exit (#6115)
This commit is contained in:
parent
10536f70f3
commit
46f64c6fdc
10
src/main.rs
10
src/main.rs
@ -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!());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user