Loops return external stream when external command failed. (#8646)

This commit is contained in:
WindSoilder
2023-04-06 01:38:04 +08:00
committed by GitHub
parent 1fcb98289a
commit 54a18991ab
7 changed files with 83 additions and 4 deletions

View File

@@ -31,3 +31,12 @@ fn while_break_on_external_failed() {
// so our output will be `1`
assert_eq!(actual.out, "1");
}
#[test]
fn failed_while_should_break_running() {
let actual = nu!(
cwd: ".",
"mut total = 0; while $total < 2 { $total = $total + 1; nu --testbin fail }; print 3"
);
assert!(!actual.out.contains('3'));
}