X-Git-Url: http://git.tdb.fi/?p=builder.git;a=blobdiff_plain;f=source%2Fexternaltask.cpp;h=f7ab199b417121712ef3d9a408a58565cc6961d8;hp=d9832c2c3e5986587621d6d54c4a6e6991409b7b;hb=a5a1ecb806ec2dec26701b931b8d2d6cbe7f4928;hpb=f622661da16d5724a778f87c5be46fe9be8a6412 diff --git a/source/externaltask.cpp b/source/externaltask.cpp index d9832c2..f7ab199 100644 --- a/source/externaltask.cpp +++ b/source/externaltask.cpp @@ -128,9 +128,9 @@ Task::Status ExternalTask::wait() Task::Status ExternalTask::do_wait(bool block) { - if(process) + while(process) { - if(process->wait(block)) + if(process->wait(!capture_pipe)) { exit_code = process->get_exit_code(); delete process; @@ -138,7 +138,7 @@ Task::Status ExternalTask::do_wait(bool block) } // Do this after waiting to avoid a race condition - while(capture_pipe && IO::poll(*capture_pipe, IO::P_INPUT, Time::zero)) + while(capture_pipe && IO::poll(*capture_pipe, IO::P_INPUT, 10*Time::msec)) { char buf[1024]; unsigned len = capture_pipe->read(buf, sizeof(buf)); @@ -149,7 +149,10 @@ Task::Status ExternalTask::do_wait(bool block) } if(process) - return RUNNING; + { + if(!block) + return RUNNING; + } else signal_finished.emit(!exit_code); }