Reap jobs before calling select() in job_continue()

Prior to b0e09303a, simple jobs like `printf "%s\n" $line | read word _`
never hit the call to select() because they were reaped in the SIGCHLD
signal handler. With that commit, the signal handler no longer reaps
children, and a job like that would enter select() and hit the 10000μs
timeout before discovering that the job was already complete.

Fixes #1884.
This commit is contained in:
Kevin Ballard 2015-01-12 22:26:07 -08:00
parent 34db67680d
commit 6e2132e01f

View File

@ -1012,6 +1012,9 @@ static int select_try(job_t *j)
tv.tv_usec=10000;
retval =select(maxfd+1, &fds, 0, 0, &tv);
if (retval == 0) {
debug(3, L"select_try hit timeout\n");
}
return retval > 0;
}
@ -1224,6 +1227,9 @@ void job_continue(job_t *j, bool cont)
{
bool quit = false;
/* Look for finished processes first, to avoid select() if it's already done. */
process_mark_finished_children(false);
/*
Wait for job to report.
*/