mirror of
https://github.com/nushell/nushell.git
synced 2024-12-24 16:09:11 +01:00
fix: reduce command have not redirected block's evaluation output (#5193)
fixes https://github.com/nushell/nushell/issues/5190
This commit is contained in:
parent
581afc9023
commit
583b7b1821
@ -129,7 +129,8 @@ impl Command for Reduce {
|
|||||||
|
|
||||||
let mut acc = start_val;
|
let mut acc = start_val;
|
||||||
|
|
||||||
for (idx, x) in input_iter.enumerate() {
|
let mut input_iter = input_iter.enumerate().peekable();
|
||||||
|
while let Some((idx, x)) = input_iter.next() {
|
||||||
stack.with_env(&orig_env_vars, &orig_env_hidden);
|
stack.with_env(&orig_env_vars, &orig_env_hidden);
|
||||||
// if the acc coming from previous iter is indexed, drop the index
|
// if the acc coming from previous iter is indexed, drop the index
|
||||||
acc = if let Value::Record { cols, vals, .. } = &acc {
|
acc = if let Value::Record { cols, vals, .. } = &acc {
|
||||||
@ -178,7 +179,8 @@ impl Command for Reduce {
|
|||||||
&mut stack,
|
&mut stack,
|
||||||
block,
|
block,
|
||||||
PipelineData::new(span),
|
PipelineData::new(span),
|
||||||
redirect_stdout,
|
// redirect stdout until its the last input value
|
||||||
|
redirect_stdout || input_iter.peek().is_some(),
|
||||||
redirect_stderr,
|
redirect_stderr,
|
||||||
)?
|
)?
|
||||||
.into_value(span);
|
.into_value(span);
|
||||||
|
Loading…
Reference in New Issue
Block a user