From c64dff716eced3fd554428b8d9e5d2f12ceac9e8 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sat, 7 May 2022 20:18:58 +0200 Subject: 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 --- sfeed_curses.c | 6 ++++++ 1 file changed, 6 insertions(+) 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(); -- cgit v1.2.3