diff options
| author | Matt Coles <mattjcoles@outlook.com> | 2026-07-30 14:46:01 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-31 00:46:01 +0300 |
| commit | b4112743cff42452b5d18558bf2d55bbbfff8c69 (patch) | |
| tree | 4e60d2635af20b35fb22fd38ae2475076b45cf8a /src | |
| parent | 0732039eaf74f2f2a235535b2f3602d3926b12ec (diff) | |
fix(client): restore terminal on sighup and sigterm
Enable termination-signal handling so SIGHUP and SIGTERM follow the graceful
quit path and restore terminal state. Log handler registration failures and
add PTY coverage for direct SIGHUP and server EOF restoration
Co-authored-by: Matt Coles <macols@amazon.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/mod.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs index 6be41c06..52fd6dd6 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -1225,11 +1225,14 @@ fn run_client_with_mode( let should_quit = Arc::new(AtomicBool::new(false)); - // Install Ctrl+C handler. + // ctrlc's "termination" feature also catches SIGTERM/SIGHUP so direct + // termination signals still run the quit path and TerminalGuard::Drop. let quit_flag = should_quit.clone(); - let _ = ctrlc::set_handler(move || { + if let Err(err) = ctrlc::set_handler(move || { quit_flag.store(true, Ordering::Release); - }); + }) { + warn!(%err, "failed to install termination handler; terminal restore relies on TerminalGuard::Drop and the panic hook"); + } let result = rt.block_on(async { run_client_loop( |
