summaryrefslogtreecommitdiff
path: root/Userland/sh.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-07 23:59:49 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-07 23:59:49 +0100
commit1dbc340da8251307d08c4264ffbc801c4174be11 (patch)
tree9140a5ecfe3460c704874c16e53f4d8c81c02e8f /Userland/sh.cpp
parentf7923498533c5385dea5b10a4d3f337a2a477a99 (diff)
downloadserenity-1dbc340da8251307d08c4264ffbc801c4174be11.zip
Get rid of the undertaker and have waitpid() be the reaper.
For dead orphans, the scheduler calls reap().
Diffstat (limited to 'Userland/sh.cpp')
-rw-r--r--Userland/sh.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Userland/sh.cpp b/Userland/sh.cpp
index 039bada919..e3b40174f6 100644
--- a/Userland/sh.cpp
+++ b/Userland/sh.cpp
@@ -248,7 +248,14 @@ static int runcmd(char* cmd)
}
int wstatus = 0;
- waitpid(child, &wstatus, 0);
+ int rc;
+ do {
+ rc = waitpid(child, &wstatus, 0);
+ if (rc < 0 && errno != EINTR) {
+ perror("waitpid");
+ break;
+ }
+ } while(errno == EINTR);
// FIXME: Should I really have to tcsetpgrp() after my child has exited?
// Is the terminal controlling pgrp really still the PGID of the dead process?