mirror of
https://github.com/nushell/nushell
synced 2025-01-13 05:38:57 +00:00
Properly drain iterating pipe so we can see errors (#1707)
This commit is contained in:
parent
81ff598d6c
commit
453087248a
1 changed files with 4 additions and 4 deletions
|
@ -82,14 +82,14 @@ fn each(
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(mut stream) => {
|
Ok(mut stream) => {
|
||||||
|
while let Some(result) = stream.next().await {
|
||||||
|
yield Ok(ReturnSuccess::Value(result));
|
||||||
|
}
|
||||||
|
|
||||||
let errors = context.get_errors();
|
let errors = context.get_errors();
|
||||||
if let Some(error) = errors.first() {
|
if let Some(error) = errors.first() {
|
||||||
yield Err(error.clone());
|
yield Err(error.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Some(result) = stream.next().await {
|
|
||||||
yield Ok(ReturnSuccess::Value(result));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
yield Err(e);
|
yield Err(e);
|
||||||
|
|
Loading…
Reference in a new issue