diff --git a/crates/nu-cli/src/commands/each.rs b/crates/nu-cli/src/commands/each.rs index e916a6655d..c863367d19 100644 --- a/crates/nu-cli/src/commands/each.rs +++ b/crates/nu-cli/src/commands/each.rs @@ -82,14 +82,14 @@ fn each( match result { Ok(mut stream) => { + while let Some(result) = stream.next().await { + yield Ok(ReturnSuccess::Value(result)); + } + let errors = context.get_errors(); if let Some(error) = errors.first() { yield Err(error.clone()); } - - while let Some(result) = stream.next().await { - yield Ok(ReturnSuccess::Value(result)); - } } Err(e) => { yield Err(e);