summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-05-07 20:18:58 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-05-07 20:18:58 +0200
commitc64dff716eced3fd554428b8d9e5d2f12ceac9e8 (patch)
treed79da4966bfa9e58cdb78ae1ab27a8f73c3bd1bb
parent78e54359372d02d17e9ab453c7bc0cd725b807f2 (diff)
sfeed_curses: interrupt waitpid while interactive child program is running
This now handles SIGTERM on sfeed_curses properly while an interactive child program is running. Test-case program: https://git.codemadness.org/sfeed_tests/commit/cd4268d4f71b5d7ab0df593d95e70188475d76bb.html
-rw-r--r--sfeed_curses.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sfeed_curses.c b/sfeed_curses.c
index 78071b7..d22d16c 100644
--- a/sfeed_curses.c
+++ b/sfeed_curses.c
@@ -575,8 +575,14 @@ processexit(pid_t pid, int interactive)
/* ignore SIGINT (^C) in parent for interactive applications */
sa.sa_handler = SIG_IGN;
sigaction(SIGINT, &sa, NULL);
+
+ sa.sa_flags = 0; /* do not restart SIGTERM: this interrupts waitpid() */
+ sa.sa_handler = sighandler;
+ sigaction(SIGTERM, &sa, NULL);
+
/* wait for process to change state, ignore errors */
waitpid(pid, NULL, 0);
+
init();
updatesidebar();
updategeom();