commit c64dff716eced3fd554428b8d9e5d2f12ceac9e8
parent 78e54359372d02d17e9ab453c7bc0cd725b807f2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 7 May 2022 20:18:58 +0200
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
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git 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();