forked from extern/nushell
save: print to stderr for bytestream (#13422)
# Description Fixes: #13260 When user run a command like this: ```nushell $env.FOO = " New"; $env.BAZ = " New Err"; do -i {nu -n -c 'nu --testbin echo_env FOO; nu --testbin echo_env_stderr BAZ'} | save -a -r save_test_22/log.txt ``` `save` command sinks the output of previous commands' stderr output. I think it should be `stderr`. # User-Facing Changes ```nushell $env.FOO = " New"; $env.BAZ = " New Err"; do -i {nu -n -c 'nu --testbin echo_env FOO; nu --testbin echo_env_stderr BAZ'} | save -a -r save_test_22/log.txt ``` The command will output ` New Err` to stderr. # Tests + Formatting Added 2 cases.
This commit is contained in:
@ -121,9 +121,11 @@ impl Command for Save {
|
||||
} else {
|
||||
match stderr {
|
||||
ChildPipe::Pipe(mut pipe) => {
|
||||
io::copy(&mut pipe, &mut io::sink())
|
||||
io::copy(&mut pipe, &mut io::stderr())
|
||||
}
|
||||
ChildPipe::Tee(mut tee) => {
|
||||
io::copy(&mut tee, &mut io::stderr())
|
||||
}
|
||||
ChildPipe::Tee(mut tee) => io::copy(&mut tee, &mut io::sink()),
|
||||
}
|
||||
.err_span(span)?;
|
||||
}
|
||||
|
Reference in New Issue
Block a user