Browse Source

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`.
master
Přemysl Eric Janouch 2 years ago
parent
commit
6aa4bd2ff5
Signed by: p
GPG Key ID: A0420B94F92B9493
  1. 2
      sdn.cpp

2
sdn.cpp

@ -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)) {

Loading…
Cancel
Save