diff --git a/crates/nu-cmd-lang/src/core_commands/ignore.rs b/crates/nu-cmd-lang/src/core_commands/ignore.rs index f01e52241d..79746bb533 100644 --- a/crates/nu-cmd-lang/src/core_commands/ignore.rs +++ b/crates/nu-cmd-lang/src/core_commands/ignore.rs @@ -32,20 +32,20 @@ impl Command for Ignore { &self, _engine_state: &EngineState, _stack: &mut Stack, - call: &Call, + _call: &Call, input: PipelineData, ) -> Result { - input.into_value(call.head); + input.drain()?; Ok(PipelineData::empty()) } fn run_const( &self, _working_set: &StateWorkingSet, - call: &Call, + _call: &Call, input: PipelineData, ) -> Result { - input.into_value(call.head); + input.drain()?; Ok(PipelineData::empty()) } diff --git a/crates/nu-command/tests/commands/ignore.rs b/crates/nu-command/tests/commands/ignore.rs new file mode 100644 index 0000000000..3d5d8fbd2e --- /dev/null +++ b/crates/nu-command/tests/commands/ignore.rs @@ -0,0 +1,7 @@ +use nu_test_support::nu; + +#[test] +fn ignore_still_causes_stream_to_be_consumed_fully() { + let result = nu!("[foo bar] | each { |val| print $val; $val } | ignore"); + assert_eq!("foobar", result.out); +} diff --git a/crates/nu-command/tests/commands/mod.rs b/crates/nu-command/tests/commands/mod.rs index d6557af6b7..94873132dd 100644 --- a/crates/nu-command/tests/commands/mod.rs +++ b/crates/nu-command/tests/commands/mod.rs @@ -45,6 +45,7 @@ mod hash_; mod headers; mod help; mod histogram; +mod ignore; mod insert; mod inspect; mod interleave;