aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sdn.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/sdn.cpp b/sdn.cpp
index 8019891..9734a80 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -834,7 +834,11 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
default:
// ...and make sure of it in the parent as well
(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));
}