Handle pty char recv errors
The main loop is now exitted if the char sender hangs up.
This commit is contained in:
parent
06451fbab1
commit
6f3e890197
10
src/main.rs
10
src/main.rs
|
@ -180,8 +180,12 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while let Ok(c) = chars_rx.try_recv() {
|
loop {
|
||||||
pty_parser.advance(&mut terminal, c);
|
match chars_rx.try_recv() {
|
||||||
|
Ok(c) => pty_parser.advance(&mut terminal, c),
|
||||||
|
Err(TryRecvError::Disconnected) => break 'main_loop,
|
||||||
|
Err(TryRecvError::Empty) => break,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -210,5 +214,7 @@ fn main() {
|
||||||
|
|
||||||
window.swap_buffers().unwrap();
|
window.swap_buffers().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO handle child cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue