redirection: fix internal commands error with o+e> redirection (#10816)

# Description
Currently the following command is broken:
```nushell
echo a o+e> 1.txt
```

It's because we don't redirect output of `echo` command. This pr is
trying to fix it.
This commit is contained in:
WindSoilder
2023-10-25 22:35:51 +08:00
committed by GitHub
parent d93315d8f5
commit f35741d50e
2 changed files with 18 additions and 13 deletions

View File

@ -925,15 +925,18 @@ fn eval_element_with_input(
*is_subexpression,
)?
}
_ => eval_element_with_input(
engine_state,
stack,
&PipelineElement::Expression(*cmd_span, cmd_exp.clone()),
input,
redirect_stdout,
redirect_stderr,
)
.map(|x| x.0)?,
_ => {
// we need to redirect output, so the result can be saved and pass to `save` command.
eval_element_with_input(
engine_state,
stack,
&PipelineElement::Expression(*cmd_span, cmd_exp.clone()),
input,
true,
redirect_stderr,
)
.map(|x| x.0)?
}
};
eval_element_with_input(
engine_state,