mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Fix return setting last exit code (#14120)
# Description Fixes #14113 and #14112. # Tests + Formatting Added a test.
This commit is contained in:
@ -32,3 +32,9 @@ fn return_works_in_script_with_def_main() {
|
||||
);
|
||||
assert!(actual.err.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn return_does_not_set_last_exit_code() {
|
||||
let actual = nu!("hide-env LAST_EXIT_CODE; do --env { return 42 }; $env.LAST_EXIT_CODE?");
|
||||
assert!(matches!(actual.out.as_str(), ""));
|
||||
}
|
||||
|
Reference in New Issue
Block a user