From 5d9c428294dd320db0b72257cb5e2c655f954267 Mon Sep 17 00:00:00 2001 From: raphCode <15750438+raphCode@users.noreply.github.com> Date: Tue, 21 Jun 2022 20:40:26 +0200 Subject: [PATCH] fix: exit client on empty rcv (#1535) * Exit client on empty ipc receive This resolves a hang when the server goes away unnoticed (e.g. when it is killed). In some cases, this delayed system shutdown because the client did not react to systemd's SIGTERM. * Add newline after error report to tidy up shell prompt * Update changelog --- CHANGELOG.md | 1 + zellij-client/src/lib.rs | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d716528c..f2fdc448 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * chore(dependencies): update `clap`: `3.1.18` -> `3.2.2` (https://github.com/zellij-org/zellij/pull/1496) * add: capability to dispatch actions from the cli (https://github.com/zellij-org/zellij/pull/1265) Can be invoked through `zellij action [ACTIONS]`. +* fix: client hang when server is killed / shutdown delay (https://github.com/zellij-org/zellij/pull/1535) Automatically sends the action to the current session, or if there is just one to the single session, if there are multiple sessions, then the session name diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index 0afbe913..aeb74abb 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -297,6 +297,12 @@ pub fn start_client( .send(ClientInstruction::UnblockInputThread) .unwrap(); log::error!("Received empty message from server"); + send_client_instructions + .send(ClientInstruction::Error( + "Received empty message from server".to_string(), + )) + .unwrap(); + break; }, } } @@ -309,7 +315,7 @@ pub fn start_client( let restore_snapshot = "\u{1b}[?1049l"; os_input.disable_mouse(); let error = format!( - "{}\n{}{}", + "{}\n{}{}\n", restore_snapshot, goto_start_of_last_line, backtrace ); let _ = os_input