X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fsystem_exec.cc;h=60e73badfcf19eb567ebe72f91a2a63253608819;hb=b11a18d226ba505c3f873f9bbf242fbb9391f42f;hp=01c46aa9eb62b603922aca904a1a3a3e0ceb34cf;hpb=94e084162590da9f61653224362e9da4ce8e3e13;p=ardour.git diff --git a/libs/pbd/system_exec.cc b/libs/pbd/system_exec.cc index 01c46aa9eb..60e73badfc 100644 --- a/libs/pbd/system_exec.cc +++ b/libs/pbd/system_exec.cc @@ -55,7 +55,10 @@ using namespace std; using namespace PBD; static void * interposer_thread (void *arg); + +#ifndef PLATFORM_WINDOWS /* POSIX Process only */ static void close_fd (int& fd) { if (fd >= 0) ::close (fd); fd = -1; } +#endif #if (!defined PLATFORM_WINDOWS && defined NO_VFORK) /* @@ -413,8 +416,7 @@ int SystemExec::wait (int options) { while (is_running()) { - WaitForSingleObject(pid->hProcess, INFINITE); - Sleep(20); + WaitForSingleObject(pid->hProcess, 40); } return 0; } @@ -422,7 +424,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