diff options
author | Kevin Ballard <kevin@sb.org> | 2015-01-12 22:26:07 -0800 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2015-01-12 22:26:07 -0800 |
commit | 6e2132e01f08123436011f4bed07548d23784560 (patch) | |
tree | 1b89394cabb7acb10ae26968edaf8607beb8522b /proc.cpp | |
parent | 34db67680dd307bf5c60f46b1f723be2c803e32a (diff) |
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.
Diffstat (limited to 'proc.cpp')
-rw-r--r-- | proc.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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. */ |