diff options
| author | 2020-05-29 18:40:45 +0200 | |
|---|---|---|
| committer | 2020-05-29 22:48:36 +0200 | |
| commit | 3426d0d0a3fd22c1064fdaf08d573244e080c339 (patch) | |
| tree | e0e9f10c77e2dd92706fd6bdbeee13baee0c5067 /src | |
| parent | 2232772db4f00eb936ee66e57d35dd8bc5344d86 (diff) | |
| download | nnn-3426d0d0a3fd22c1064fdaf08d573244e080c339.tar.gz | |
Cleanly handle SIGTERM and SIGHUP
Diffstat (limited to 'src')
| -rw-r--r-- | src/nnn.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -704,6 +704,13 @@ static void sigint_handler(int UNUSED(sig)) g_states |= STATE_INTERRUPTED; } +static void clean_exit_sighandler(int UNUSED(sig)) +{ + exitcurses(); + /* This triggers cleanup() thanks to atexit() */ + exit(EXIT_SUCCESS); +} + static char *xitoa(uint val) { static char ascbuf[32] = {0}; @@ -7230,6 +7237,8 @@ int main(int argc, char *argv[]) xerror(); return EXIT_FAILURE; } + signal(SIGTERM, clean_exit_sighandler); + signal(SIGHUP, clean_exit_sighandler); signal(SIGQUIT, SIG_IGN); #ifndef NOLOCALE |