aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zencore/thread.cpp')
-rw-r--r--src/zencore/thread.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/zencore/thread.cpp b/src/zencore/thread.cpp
index 67a0878d0..a44c0ee90 100644
--- a/src/zencore/thread.cpp
+++ b/src/zencore/thread.cpp
@@ -1065,9 +1065,20 @@ IsProcessRunning(int pid)
ThrowSystemError(Error, fmt::format("failed to open process with pid {}", pid));
}
+ bool bStillActive = true;
+ DWORD ExitCode = 0;
+ if (0 != GetExitCodeProcess(hProc, &ExitCode))
+ {
+ bStillActive = ExitCode == STILL_ACTIVE;
+ }
+ else
+ {
+ ZEN_WARN("Unable to get exit code from handle for process '{}', treating the process as active", pid);
+ }
+
CloseHandle(hProc);
- return true;
+ return bStillActive;
#elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC
return (kill(pid_t(pid), 0) == 0);
#endif