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
This commit is contained in:
raphCode 2022-06-21 20:40:26 +02:00 committed by GitHub
parent 29332ca684
commit 5d9c428294
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -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) * 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) * add: capability to dispatch actions from the cli (https://github.com/zellij-org/zellij/pull/1265)
Can be invoked through `zellij action [ACTIONS]`. 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 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 to the single session, if there are multiple sessions, then the session name

View file

@ -297,6 +297,12 @@ pub fn start_client(
.send(ClientInstruction::UnblockInputThread) .send(ClientInstruction::UnblockInputThread)
.unwrap(); .unwrap();
log::error!("Received empty message from server"); 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"; let restore_snapshot = "\u{1b}[?1049l";
os_input.disable_mouse(); os_input.disable_mouse();
let error = format!( let error = format!(
"{}\n{}{}", "{}\n{}{}\n",
restore_snapshot, goto_start_of_last_line, backtrace restore_snapshot, goto_start_of_last_line, backtrace
); );
let _ = os_input let _ = os_input