summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraphCode <15750438+raphCode@users.noreply.github.com>2022-03-25 16:30:32 +0100
committerGitHub <noreply@github.com>2022-03-25 16:30:32 +0100
commitbda37c3dd38a6a311e27352496d443863e99bf06 (patch)
tree841446a5e7d064755f6e8f4bc551e52ab40be59f
parent05e6579508da0fa893496122701e0586ed464d96 (diff)
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>
-rw-r--r--zellij-server/src/tab/mod.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 490a9b7be..baa69175c 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -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) {