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

@@ -28,3 +28,27 @@ fn for_break_on_external_failed() {
// so our output will be `1`
assert_eq!(actual.out, "1");
}
#[test]
fn failed_for_should_break_running() {
let actual = nu!(
cwd: ".",
r#"
for i in 1..2 {
nu --testbin fail
}
print 3"#
);
assert!(!actual.out.contains('3'));
let actual = nu!(
cwd: ".",
r#"
let x = [1 2]
for i in $x {
nu --testbin fail
}
print 3"#
);
assert!(!actual.out.contains('3'));
}