fix unterminated loop when a tab is closed and others remain

We weren't detecting EOF reading from the pty
This commit is contained in:
Wez Furlong committed 2019-02-23 14:34:17 -08:00
1 parent db5aac6681
commit 7a1d691163
1 file changed
+9 -1
+9 -1
View File
@@ -328,6 +328,11 @@ impl GuiEventLoop {
let mut buf = [0; BUFSIZE];
loop {
match pty.read(&mut buf) {
Ok(size) if size == 0 => {
eprintln!("read_pty EOF: window {:?} {}", window_id, tab_id);
tx.send(IOEvent::Terminated { window_id, tab_id }).ok();
return;
}
Ok(size) => {
if tx
.send(IOEvent::Data {
@@ -341,7 +346,10 @@ impl GuiEventLoop {
}
}
Err(err) => {
eprintln!("window {:?} {} {:?}", window_id, tab_id, err);
eprintln!(
"read_pty failed: window {:?} {} {:?}",
window_id, tab_id, err
);
tx.send(IOEvent::Terminated { window_id, tab_id }).ok();
return;
}