diff --git a/crates/nu-engine/src/eval.rs b/crates/nu-engine/src/eval.rs index de4d4c6b43..0541125ed7 100644 --- a/crates/nu-engine/src/eval.rs +++ b/crates/nu-engine/src/eval.rs @@ -438,12 +438,12 @@ fn eval_element_with_input_inner( } } - let data = match (data, stack.pipe_stdout()) { - ( - data @ (PipelineData::Value(..) | PipelineData::ListStream(..)), - Some(IoStream::File(_)), - ) => data.write_to_io_streams(engine_state, stack)?, - (data, _) => data, + let data = if matches!(stack.pipe_stdout(), Some(IoStream::File(_))) + && !matches!(stack.pipe_stderr(), Some(IoStream::Pipe)) + { + data.write_to_io_streams(engine_state, stack)? + } else { + data }; Ok((data, ok))