make stderr works for failed external command (#11914)

# Description
Fixes: #11913

When running external command, nushell shouldn't consumes stderr
messages, if user want to redirect stderr.

# User-Facing Changes
NaN

# Tests + Formatting
Done

# After Submitting
NaN
This commit is contained in:
Wind
2024-02-21 21:15:05 +08:00
committed by GitHub
parent 6e590fe0a2
commit 1058707a29
5 changed files with 45 additions and 1 deletions

View File

@ -158,6 +158,14 @@ fn basic_outerr_pipe_works() {
assert_eq!(actual.out, "8");
}
#[test]
fn err_pipe_with_failed_external_works() {
let actual =
nu!(r#"with-env [FOO "bar"] { nu --testbin echo_env_stderr_fail FOO e>| str length }"#);
// there is a `newline` output from nu --testbin
assert_eq!(actual.out, "4");
}
mod it_evaluation {
use super::nu;
use nu_test_support::fs::Stub::{EmptyFile, FileWithContent, FileWithContentToBeTrimmed};