diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/Windows/Program.inc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/Windows/Program.inc b/llvm/lib/Support/Windows/Program.inc index 32602345f65..75685de4554 100644 --- a/llvm/lib/Support/Windows/Program.inc +++ b/llvm/lib/Support/Windows/Program.inc @@ -423,6 +423,7 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, return WaitResult; } WaitForSingleObject(PI.ProcessHandle, INFINITE); + CloseHandle(PI.ProcessHandle); } else { // Non-blocking wait. return ProcessInfo(); @@ -433,7 +434,8 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, DWORD status; BOOL rc = GetExitCodeProcess(PI.ProcessHandle, &status); DWORD err = GetLastError(); - CloseHandle(PI.ProcessHandle); + if (err != ERROR_INVALID_HANDLE) + CloseHandle(PI.ProcessHandle); if (!rc) { SetLastError(err); |