Currently we perform shutdown on exit the other way round. Hence the
running external command may interfere with the shutdown of the curses
system. This patch changes die() to first signal the child processes,
then wait for them to terminate. This avoids the race.
+ /* Kill every process in our process group. */
+ para_sigaction(SIGTERM, SIG_IGN);
+ kill(0, SIGTERM);
+ /* Wait up to two seconds for child processes to die. */
+ alarm(2);
+ while (waitpid(0, NULL, 0) >= 0)
+ ; /* nothing */
+ alarm(0);
/* mousemask() exists only in ncurses */
#ifdef NCURSES_MOUSE_VERSION
mousemask(~(mmask_t)0, NULL); /* Avoid bad terminal state with xterm. */
/* mousemask() exists only in ncurses */
#ifdef NCURSES_MOUSE_VERSION
mousemask(~(mmask_t)0, NULL); /* Avoid bad terminal state with xterm. */
va_start(argp, fmt);
vfprintf(stderr, fmt, argp);
va_end(argp);
va_start(argp, fmt);
vfprintf(stderr, fmt, argp);
va_end(argp);
- /* kill every process in the process group and exit */
- para_sigaction(SIGTERM, SIG_IGN);
- kill(0, SIGTERM);