Fix non-zero exit code errors in middle of pipeline (#13899)

# Description
Fixes #13868. Should come after #13885.

# User-Facing Changes
Bug fix.

# Tests + Formatting
Added a test.
This commit is contained in:
Ian Manske
2024-10-02 04:04:18 -07:00
committed by GitHub
parent 475aa4f1dd
commit f03ba6793e
7 changed files with 37 additions and 8 deletions

View File

@ -6,6 +6,14 @@ use pretty_assertions::assert_eq;
#[test]
fn doesnt_break_on_utf8() {
let actual = nu!("echo ö");
assert_eq!(actual.out, "ö", "'{}' should contain ö", actual.out);
}
#[test]
fn non_zero_exit_code_in_middle_of_pipeline_ignored() {
let actual = nu!("nu -c 'print a b; exit 42' | collect");
assert_eq!(actual.out, "ab");
let actual = nu!("nu -c 'print a b; exit 42' | nu --stdin -c 'collect'");
assert_eq!(actual.out, "ab");
}