app: leave SIGHUP alone so nohup keeps the app running (#248 follow-up)

#445 also closed the window on SIGHUP, which overrides the SIG_IGN that
`nohup fieldcraft &` sets so the app outlives its terminal. A safe API cannot
ask whether a signal was ignored at launch, so SIGHUP keeps its default.
SIGTERM and SIGINT still close the window the normal way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-16 00:47:35 -04:00
1 parent 9a30c7d9ed
commit 7a5363e07b
4 files changed
+11 -8

No files matched your search

+7 -4
View File
@@ -1,6 +1,6 @@
//! A request to terminate (SIGTERM, SIGINT, SIGHUP on Unix) closes the window the normal way.
//! A request to terminate (SIGTERM, SIGINT on Unix) closes the window the normal way.
//!
//! Without this, `kill PID`, Ctrl-C in the terminal, a session logout or a test harness's timeout
//! Without this, `kill PID`, Ctrl-C in the terminal, a system shutdown or a test harness's timeout
//! ended the process on the spot: no `on_exit`, so no last autosave and no clean end of the crash
//! journal, and the next start filed an `unclean_exit` crash report for what was no crash (#248:
//! "ended without a clean exit between commands (last: control ui.capture)" was an automation run
@@ -9,6 +9,10 @@
//! so a run that still dies while closing says why. A second signal, for a window that does not
//! close, ends the process at once with the signal's default action.
//!
//! SIGHUP is left alone: `nohup fieldcraft &` ignores it on purpose so the app outlives its
//! terminal, and a handler would override that (a safe API cannot ask whether a signal was
//! ignored at launch).
//!
//! Windows has no such signals: a window there is closed through its messages, which eframe
//! already turns into a normal close.
@@ -16,7 +20,7 @@ use std::io;
/// The signals that ask the app to terminate.
#[cfg(unix)]
const SIGNALS: [i32; 3] = [signal_hook::consts::SIGTERM, signal_hook::consts::SIGINT, signal_hook::consts::SIGHUP];
const SIGNALS: [i32; 2] = [signal_hook::consts::SIGTERM, signal_hook::consts::SIGINT];
/// The signal's usual name, for the log and the crash journal.
#[cfg(unix)]
@@ -24,7 +28,6 @@ fn name(signal: i32) -> &'static str {
match signal {
signal_hook::consts::SIGTERM => "SIGTERM",
signal_hook::consts::SIGINT => "SIGINT",
signal_hook::consts::SIGHUP => "SIGHUP",
_ => "signal",
}
}