possible fix for win SystemExec::wait()
authorRobin Gareus <robin@gareus.org>
Fri, 11 Jul 2014 15:03:55 +0000 (17:03 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 11 Jul 2014 15:03:55 +0000 (17:03 +0200)
if it does not help, use CREATE_NO_WINDOW and/or peek/pump messages :(

libs/pbd/system_exec.cc

index 01c46aa9eb62b603922aca904a1a3a3e0ceb34cf..123fb909ad4f971ae4a2960e637fb7429bac6982 100644 (file)
@@ -413,8 +413,7 @@ int
 SystemExec::wait (int options)
 {
        while (is_running()) {
-               WaitForSingleObject(pid->hProcess, INFINITE);
-               Sleep(20);
+               WaitForSingleObject(pid->hProcess, 40);
        }
        return 0;
 }
@@ -422,7 +421,12 @@ SystemExec::wait (int options)
 bool
 SystemExec::is_running ()
 {
-       return pid?true:false;
+       if (!pid) return false;
+       DWORD exit_code;
+       if (GetExitCodeProcess(pid->hProcess, &exit_code)) {
+               if (exit_code == STILL_ACTIVE) return true;
+       }
+       return false;
 }
 
 int