1
0
mirror of https://github.com/nushell/nushell.git synced 2025-06-29 22:28:35 +02:00

Handle ctrl-c in RawStream iterator ()

Fixes  and .

Darren noticed that `open /dev/random` could not be interrupted by
`ctrl+c`. Thankfully the solution was very simple; it looks like we just
forgot to check `ctrlc` in the `impl Iterator for RawStream`!

To reproduce this, just run `open /dev/random` and then cancel it with
`ctrl+c`.
This commit is contained in:
Reilly Wood
2022-12-02 08:00:56 -08:00
committed by GitHub
parent bc0c9ab698
commit 3ac36879e0

@ -77,6 +77,12 @@ impl Iterator for RawStream {
type Item = Result<Value, ShellError>;
fn next(&mut self) -> Option<Self::Item> {
if let Some(ctrlc) = &self.ctrlc {
if ctrlc.load(Ordering::SeqCst) {
return None;
}
}
// If we know we're already binary, just output that
if self.is_binary {
match self.stream.next() {