diff options
author | Christian Hesse <mail@eworm.de> | 2023-10-24 09:45:45 +0200 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2024-01-15 17:05:05 +0100 |
commit | 8e40d688679a4ea7a56649b621e6be0929d72bf6 (patch) | |
tree | ad67ab9faeb52597e0fbe554cca51eecdf6b061c /CRT.c | |
parent | b6b9384678fa111d47a8d3074c31490863619d12 (diff) |
CRT: print a warning when exiting on signal
Every now and then users complain about settings to being persisted.
Most of the time this turns out to be caused by user: Exiting with
signal causes htop not to save settings to htoprc.
Make htop print a warning when exiting on signal.
Diffstat (limited to 'CRT.c')
-rw-r--r-- | CRT.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -803,8 +803,16 @@ int CRT_scrollWheelVAmount = 10; ColorScheme CRT_colorScheme = COLORSCHEME_DEFAULT; ATTR_NORETURN -static void CRT_handleSIGTERM(ATTR_UNUSED int sgn) { +static void CRT_handleSIGTERM(int sgn) { CRT_done(); + + const char* signal_str = strsignal(sgn); + if (!signal_str) + signal_str = "unknown reason"; + + fprintf(stderr, + "A signal %d (%s) was received, exiting without persisting settings to htoprc.\n", + sgn, signal_str); _exit(0); } |