Unverified Commit 6f957bca authored by Michael Snoyman's avatar Michael Snoyman Committed by GitHub

Merge pull request #159 from Mistuke/wip/wait-for-actual-process-termination

Windows: Check if all processes really exited and released resources
parents c4487496 8cb23fd4
......@@ -903,7 +903,8 @@ waitForJobCompletion ( HANDLE hJob, HANDLE ioPort, DWORD timeout, int *pExitCode
// List of events we can listen to:
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms684141(v=vs.85).aspx
while (GetQueuedCompletionStatus (ioPort, &CompletionCode,
&CompletionKey, &Overlapped, timeout)) {
&CompletionKey, &Overlapped, timeout)
&& (HANDLE)CompletionKey == hJob) {
switch (CompletionCode)
{
......@@ -930,6 +931,10 @@ waitForJobCompletion ( HANDLE hJob, HANDLE ioPort, DWORD timeout, int *pExitCode
maperrno();
return 1;
}
// Check to see if the child has actually exited.
if (*(DWORD *)pExitCode == STILL_ACTIVE)
waitForProcess ((ProcHandle)pHwnd, pExitCode);
}
break;
case JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO:
......
......@@ -2,6 +2,10 @@
## Unreleased changes
* Fix a race condition on Windows that happens when you use process jobs and one of
the child processes terminates but doesn't release its resources immediately.
Control returns to the caller too soon in this scenario. See [#159](https://github.com/haskell/process/pull/159)
## 1.6.6.0 *October 2019*
* Fix a potential privilege escalation issue (or, more precisely, privileges
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment