refactor error/eof case in mux pty reader

This commit is contained in:
Wez Furlong committed 2019-03-05 20:13:40 +00:00
1 parent b24f27d2a7
commit e3fa12ee41
1 file changed
+10 -15
+10 -15
View File
@@ -23,12 +23,11 @@ fn read_from_tab_pty(executor: Box<Executor>, tab_id: TabId, mut reader: Box<std
match reader.read(&mut buf) {
Ok(size) if size == 0 => {
eprintln!("read_pty EOF: tab_id {}", tab_id);
Future::with_executor(executor.clone_executor(), move || {
let mux = Mux::get().unwrap();
mux.remove_tab(tab_id);
Ok(())
});
return;
break;
}
Err(err) => {
eprintln!("read_pty failed: tab {} {:?}", tab_id, err);
break;
}
Ok(size) => {
let data = buf[0..size].to_vec();
@@ -45,17 +44,13 @@ fn read_from_tab_pty(executor: Box<Executor>, tab_id: TabId, mut reader: Box<std
Ok(())
});
}
Err(err) => {
eprintln!("read_pty failed: tab {} {:?}", tab_id, err);
Future::with_executor(executor.clone_executor(), move || {
let mux = Mux::get().unwrap();
mux.remove_tab(tab_id);
Ok(())
});
return;
}
}
}
Future::with_executor(executor.clone_executor(), move || {
let mux = Mux::get().unwrap();
mux.remove_tab(tab_id);
Ok(())
});
}
/// This is just a stub impl of TerminalHost; it really only exists