Handle pty char recv errors

The main loop is now exitted if the char sender hangs up.
This commit is contained in:
Joe Wilm 2016-06-07 21:12:21 -07:00
parent 06451fbab1
commit 6f3e890197
No known key found for this signature in database
GPG Key ID: 39B57C6972F518DA
1 changed files with 8 additions and 2 deletions

View File

@ -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
} }