Guard against ^Z in helper programs

Resume them immediately, we are not a shell.
This commit is contained in:
Přemysl Eric Janouch 2019-12-09 19:01:16 +01:00
parent 7cce0cc2fd
commit 571ec74706
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 5 additions and 1 deletions

View File

@ -834,7 +834,11 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
default: default:
// ...and make sure of it in the parent as well // ...and make sure of it in the parent as well
(void) setpgid (child, child); (void) setpgid (child, child);
waitpid (child, &status, 0);
// 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);
tcsetpgrp (STDOUT_FILENO, getpgid (0)); tcsetpgrp (STDOUT_FILENO, getpgid (0));
} }