From 0892a16a3d046c401df4b3691286d3c0d9524484 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Sat, 9 Apr 2022 07:57:43 +1200 Subject: [PATCH] Let 'each' also send input to block (#5136) --- crates/nu-command/src/filters/each.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/nu-command/src/filters/each.rs b/crates/nu-command/src/filters/each.rs index e4fad2bbaa..f8162ddfdc 100644 --- a/crates/nu-command/src/filters/each.rs +++ b/crates/nu-command/src/filters/each.rs @@ -2,8 +2,8 @@ use nu_engine::{eval_block, CallExt}; use nu_protocol::ast::Call; use nu_protocol::engine::{CaptureBlock, Command, EngineState, Stack}; use nu_protocol::{ - Category, Example, IntoInterruptiblePipelineData, PipelineData, Signature, Span, SyntaxShape, - Value, + Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, Signature, + Span, SyntaxShape, Value, }; #[derive(Clone)] @@ -150,13 +150,13 @@ impl Command for Each { val: idx as i64, span, }, - x, + x.clone(), ], span, }, ); } else { - stack.add_var(*var_id, x); + stack.add_var(*var_id, x.clone()); } } } @@ -165,7 +165,7 @@ impl Command for Each { &engine_state, &mut stack, &block, - PipelineData::new(span), + x.into_pipeline_data(), redirect_stdout, redirect_stderr, ) { @@ -201,13 +201,13 @@ impl Command for Each { val: idx as i64, span, }, - x, + x.clone(), ], span, }, ); } else { - stack.add_var(*var_id, x); + stack.add_var(*var_id, x.clone()); } } } @@ -216,7 +216,7 @@ impl Command for Each { &engine_state, &mut stack, &block, - PipelineData::new(span), + x.into_pipeline_data(), redirect_stdout, redirect_stderr, ) { @@ -228,7 +228,7 @@ impl Command for Each { PipelineData::Value(x, ..) => { if let Some(var) = block.signature.get_positional(0) { if let Some(var_id) = &var.var_id { - stack.add_var(*var_id, x); + stack.add_var(*var_id, x.clone()); } } @@ -236,7 +236,7 @@ impl Command for Each { &engine_state, &mut stack, &block, - PipelineData::new(span), + x.into_pipeline_data(), redirect_stdout, redirect_stderr, )