diff options
author | 2012-11-04 15:45:52 -0800 | |
---|---|---|
committer | 2012-11-04 15:45:52 -0800 | |
commit | 5e371e8fe7cbdecd87678d50d06c12851213776e (patch) | |
tree | b20fc6e456745d7f1016d02ee750101b365185ed /proc.cpp | |
parent | e46324ced9a6e1fa79ffbd56dfed652a3180b0ca (diff) |
Don't use posix_spawn for commands that need to be put into foreground to avoid a race
Fix for race where a command's output may not be fully drained
Diffstat (limited to 'proc.cpp')
-rw-r--r-- | proc.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1110,14 +1110,6 @@ void job_continue (job_t *j, int cont) } while (got_signal && !quit); - if (quit) { - // It's possible that the job will produce output and exit before we've even read from it. - // We'll eventually read the output, but it may be after we've executed subsequent calls - // This is why my prompt colors kept getting screwed up - the builtin echo calls - // were sometimes having their output combined with the set_color calls in the wrong order! - read_try(j); - } - if( !quit ) { @@ -1175,6 +1167,14 @@ void job_continue (job_t *j, int cont) if( job_is_completed( j )) { + + // It's possible that the job will produce output and exit before we've even read from it. + // We'll eventually read the output, but it may be after we've executed subsequent calls + // This is why my prompt colors kept getting screwed up - the builtin echo calls + // were sometimes having their output combined with the set_color calls in the wrong order! + read_try(j); + + process_t *p = j->first_process; while( p->next ) p = p->next; |