mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 00:13:21 +01:00
Fix LAST_EXIT_CODE
not being set for internal errors (#13954)
# Description Fixes #13949 where `$env.LAST_EXIT_CODE` was not being set for internal errors. # Tests + Formatting Cannot test due to limitations with the `nu_repl` test bin.
This commit is contained in:
parent
1d6ac16530
commit
475aa4f1dd
@ -286,6 +286,8 @@ impl Stack {
|
|||||||
pub fn set_last_error(&mut self, error: &ShellError) {
|
pub fn set_last_error(&mut self, error: &ShellError) {
|
||||||
if let Some(code) = error.external_exit_code() {
|
if let Some(code) = error.external_exit_code() {
|
||||||
self.set_last_exit_code(code.item, code.span);
|
self.set_last_exit_code(code.item, code.span);
|
||||||
|
} else {
|
||||||
|
self.set_last_exit_code(1, Span::unknown());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user