mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 02:28:35 +02:00
reset argument/redirection state after eval_call
errors (#15400)
Closes #15395 # User-Facing Changes Certain errors no longer leave the argument stack in an unexpected state: ```diff let x: any = 1; try { $x | get path } catch { print caught } -$.path # extra `print` argument from the failed `get` call caught ``` # Description If `eval_call` fails in `check_input_types` or `gather_arguments`, the cleanup code is still executed.
This commit is contained in:
@ -82,6 +82,14 @@ fn catch_block_can_use_error_object() {
|
||||
assert_eq!(output.out, "Division by zero.")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn catch_input_type_mismatch_and_rethrow() {
|
||||
let actual = nu!(
|
||||
"let x: any = 1; try { $x | get 1 } catch {|err| error make { msg: ($err | get msg) } }"
|
||||
);
|
||||
assert!(actual.err.contains("Input type not supported"));
|
||||
}
|
||||
|
||||
// This test is disabled on Windows because they cause a stack overflow in CI (but not locally!).
|
||||
// For reasons we don't understand, the Windows CI runners are prone to stack overflow.
|
||||
// TODO: investigate so we can enable on Windows
|
||||
|
Reference in New Issue
Block a user