aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-client/src/unit
diff options
context:
space:
mode:
authorraphCode <15750438+raphCode@users.noreply.github.com>2022-05-24 14:10:37 +0200
committerGitHub <noreply@github.com>2022-05-24 14:10:37 +0200
commiteab464b11adb28e504cefdc39b596d5e5787a2bb (patch)
tree5c10a63ecbd7db2c9baf1fc292f052d3e4b6ea3e /zellij-client/src/unit
parentdocs(changelog): checking for missing extensions (diff)
downloadsl0ppij-eab464b11adb28e504cefdc39b596d5e5787a2bb.tar.gz
sl0ppij-eab464b11adb28e504cefdc39b596d5e5787a2bb.tar.xz
sl0ppij-eab464b11adb28e504cefdc39b596d5e5787a2bb.zip
Fix double panic lockup in clients panic handler (#1433)
* Fix possible lockup in the clients panic handler When the pty the client was running in disappears, reading from stdin causes a panic, which triggers the custom panic handler. This handler attempts to print a backtrace to the terminal and tries to unset the raw mode for that. Since the pty has already disappeared, the tcsetattr call fails and causes a second panic, which locks everything up. This commit fixes this by returning an Result from the unset_raw_mode function, allowing the calling panic handler to handle any error gracefully. * Log any client panics to file Since we are now aware of the fact that panics may happen / are handled after the pty has disappeared, logging them to file seems useful: there is no other other place to show them to the user. * fix tests and improve function return type
Diffstat (limited to 'zellij-client/src/unit')
-rw-r--r--zellij-client/src/unit/input_handler_tests.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/zellij-client/src/unit/input_handler_tests.rs b/zellij-client/src/unit/input_handler_tests.rs
index 4b830656..ba5ac11c 100644
--- a/zellij-client/src/unit/input_handler_tests.rs
+++ b/zellij-client/src/unit/input_handler_tests.rs
@@ -2,6 +2,7 @@ use super::input_loop;
use zellij_utils::input::actions::{Action, Direction};
use zellij_utils::input::config::Config;
use zellij_utils::input::options::Options;
+use zellij_utils::nix;
use zellij_utils::pane_size::{Size, SizeInPixels};
use zellij_utils::termwiz::input::{InputEvent, KeyCode, KeyEvent, Modifiers};
use zellij_utils::zellij_tile::data::Palette;
@@ -125,7 +126,7 @@ impl ClientOsApi for FakeClientOsApi {
fn set_raw_mode(&mut self, _fd: RawFd) {
unimplemented!()
}
- fn unset_raw_mode(&self, _fd: RawFd) {
+ fn unset_raw_mode(&self, _fd: RawFd) -> Result<(), nix::Error> {
unimplemented!()
}
fn get_stdout_writer(&self) -> Box<dyn io::Write> {