forked from extern/nushell
fix panic with lines
on an error (#9967)
should close https://github.com/nushell/nushell/issues/9965 # Description this PR implements the `todo!()` left in `lines`. # User-Facing Changes ### before ```nushell > open . | lines thread 'main' panicked at 'not yet implemented', crates/nu-command/src/filters/lines.rs:248:35 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` ### after ```nushell > open . | lines Error: nu:🐚:io_error × I/O error help: Is a directory (os error 21) ``` # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - ⚫ `toolkit test` - ⚫ `toolkit test stdlib` this PR adds the `lines_on_error` test to make sure this does not happen again 😌 # After Submitting
This commit is contained in:
parent
0674d4960b
commit
202dfdaee2
@ -245,7 +245,7 @@ impl Iterator for RawStreamLinesAdapter {
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => todo!(),
|
||||
Err(err) => return Some(Err(err)),
|
||||
}
|
||||
} else {
|
||||
self.inner_complete = true;
|
||||
|
@ -61,3 +61,11 @@ fn lines_mixed_line_endings() {
|
||||
|
||||
assert_eq!(actual.out, "3");
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
#[test]
|
||||
fn lines_on_error() {
|
||||
let actual = nu!("open . | lines");
|
||||
|
||||
assert!(actual.err.contains("Is a directory"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user