Skip to content

Commit

Permalink
Stop printing out wait: no child processes on SIGINT
Browse files Browse the repository at this point in the history
Not sure what's happening here. Sometimes there's no zombie child
left after a SIGINT, and sometimes there is. Code assumes
that it always should wait. It's like we're ignoring SIGCHLD or something?
(I know nothing much about signals... why am I doing this at all? :) )

Resolves #7
  • Loading branch information
wryun committed Nov 23, 2014
1 parent 15d1abb commit 265128b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,20 @@ extern int ewait(int pid, Boolean interruptible, void *rusage) {
int status;
if (proc->alive) {
int deadpid;
int seen_eintr = FALSE;
while ((deadpid = dowait(&proc->status)) != pid)
if (deadpid != -1)
reap(deadpid, proc->status);
else if (errno != EINTR)
else if (errno == EINTR) {
if (interruptible)
SIGCHK();
seen_eintr = TRUE;
} else if (errno == ECHILD && seen_eintr)
/* TODO: not clear on why this is necessary
* (child procs _sometimes_ disappear after SIGINT) */
break;
else
fail("es:ewait", "wait: %s", esstrerror(errno));
else if (interruptible)
SIGCHK();
proc->alive = FALSE;
#if HAVE_WAIT3
proc->rusage = wait_rusage;
Expand Down

0 comments on commit 265128b

Please sign in to comment.