]> git.tdb.fi Git - builder.git/blobdiff - source/externaltask.cpp
More flexible way to manage filename patterns
[builder.git] / source / externaltask.cpp
index f7ab199b417121712ef3d9a408a58565cc6961d8..dce0e06d6157700db2efab0ca32a27d5ba26aceb 100644 (file)
@@ -1,6 +1,5 @@
 #include <cstdlib>
 #include <unistd.h>
-#include <sys/wait.h>
 #include <msp/fs/dir.h>
 #include <msp/io/console.h>
 #include <msp/io/file.h>
@@ -73,7 +72,11 @@ void ExternalTask::start()
 
        if(stdin_action==IGNORE || stdout_action==IGNORE || stderr_action==IGNORE)
        {
+#ifdef _WIN32
+               devnull = new IO::File("nul", IO::M_RDWR);
+#else
                devnull = new IO::File("/dev/null", IO::M_RDWR);
+#endif
                if(stdin_action==IGNORE)
                        process->redirect_cin(*devnull);
                if(stdout_action==IGNORE)
@@ -130,7 +133,7 @@ Task::Status ExternalTask::do_wait(bool block)
 {
        while(process)
        {
-               if(process->wait(!capture_pipe))
+               if(process->wait(block && !capture_pipe))
                {
                        exit_code = process->get_exit_code();
                        delete process;