1
0
mirror of https://github.com/nushell/nushell.git synced 2025-07-10 03:17:35 +02:00

Fix LAST_EXIT_CODE not being set for internal errors ()

# Description
Fixes  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:
Ian Manske
2024-10-02 04:00:50 -07:00
committed by GitHub
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());
} }
} }