aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Windows/Program.inc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-05-27 18:44:32 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-05-27 18:44:32 +0000
commit5a5ac124e1efaf208671f01c46edb15f29ed2a0b (patch)
treea6140557876943cdd800ee997c9317283394b22c /lib/Support/Windows/Program.inc
parentf03b5bed27d0d2eafd68562ce14f8b5e3f1f0801 (diff)
Diffstat (limited to 'lib/Support/Windows/Program.inc')
-rw-r--r--lib/Support/Windows/Program.inc3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc
index c3700774514c..75685de45547 100644
--- a/lib/Support/Windows/Program.inc
+++ b/lib/Support/Windows/Program.inc
@@ -434,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);