fix(tab): catch and report errors about tty I/O (#1051)

Quick and dirty bandaid fix to some server crashes which occur to me lately.
The underlying issue seems to be a race condition somewhere when the shell in the pane
exits and the tty file descriptor becomes invalid, but zellij wants to write/read it?

Bug trigger:
- open some panes
- exit the shells in the panes by spamming Ctrl-D

works best when the system only runs on a single CPU, run the following to disable all
cores but one:
echo 0 | sudo tee /sys/devices/system/cpu/cpu*/online

Co-authored-by: raphTec <git@raphtec.net>
This commit is contained in:
raphCode 2022-03-25 16:30:32 +01:00 committed by GitHub
parent 05e6579508
commit bda37c3dd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -849,12 +849,15 @@ impl Tab {
.get(&pane_id)
.unwrap_or_else(|| self.tiled_panes.get_pane(pane_id).unwrap());
let adjusted_input = active_terminal.adjust_input_to_terminal(input_bytes);
self.os_api
if let Err(e) = self
.os_api
.write_to_tty_stdin(active_terminal_id, &adjusted_input)
.expect("failed to write to terminal");
self.os_api
.tcdrain(active_terminal_id)
.expect("failed to drain terminal");
{
log::error!("failed to write to terminal: {}", e);
}
if let Err(e) = self.os_api.tcdrain(active_terminal_id) {
log::error!("failed to drain terminal: {}", e);
}
}
PaneId::Plugin(pid) => {
for key in parse_keys(&input_bytes) {