When resuming a child, resume the whole group

SIGTSTP is sent to the entire foreground process group,
so do the some with our SIGCONT.

Debian's default sh (dash) doesn't replace itself with
the command, even if it's the last one in the -c option.

Of course, we do not need to use /bin/sh for the helpers
at all, though it doesn't cost us much.  We could also
issue an explicit `exec`.
This commit is contained in:
Přemysl Eric Janouch 2020-10-08 19:27:19 +02:00
parent 000315165d
commit 6aa4bd2ff5
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 1 additions and 1 deletions

View File

@ -888,7 +888,7 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
// We don't provide job control--don't let us hang after ^Z
while (waitpid (child, &status, WUNTRACED) > -1 && WIFSTOPPED (status))
if (WSTOPSIG (status) == SIGTSTP)
kill (child, SIGCONT);
kill (-child, SIGCONT);
tcsetpgrp (STDOUT_FILENO, getpgid (0));
if (WIFEXITED (status) && WEXITSTATUS (status)) {