]> git.tdb.fi Git - builder.git/blobdiff - source/externaltask.cpp
Add support for the orientation tag in Android manifest
[builder.git] / source / externaltask.cpp
index e4dfdc2ef9566122042d6ad430595acb1488f6b0..07ad870e6c35ec398e2885211e31fbfe890f7d28 100644 (file)
@@ -5,7 +5,7 @@
 #include <msp/io/console.h>
 #include <msp/io/file.h>
 #include <msp/io/print.h>
-#include <msp/time/units.h>
+#include <msp/time/timedelta.h>
 #include "externaltask.h"
 
 using namespace std;
@@ -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(block && !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);
        }