job: Only force-close stdout/stderr when the job exits

stdout/stderr should only be closed after the job truly exits, or else we can
lose data sent by it.
This commit is contained in:
Thiago de Arruda
2014-11-07 02:38:12 -03:00
parent f7a468c1e7
commit d3f81424e5
2 changed files with 17 additions and 3 deletions

View File

@@ -270,10 +270,10 @@ void job_stop(Job *job)
}
job->stopped_time = os_hrtime();
// Close the standard streams of the job
// Close the job's stdin. If the job doesn't close it's own stdout/stderr,
// they will be closed when the job exits(possibly due to being terminated
// after a timeout)
close_job_in(job);
close_job_out(job);
close_job_err(job);
if (!stop_requests++) {
// When there's at least one stop request pending, start a timer that