summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2014-02-22 00:15:39 +0000
committeradamedx <adamed@opscode.com>2014-03-17 12:02:46 -0700
commite3357fc180bdd3a21da15b54d8e6daef33c309e1 (patch)
treee855c183d1d50a7c4f7528a11aaa22f819008947
parent0ba0482460c6945a22aa0b776ca3d56cd84965f6 (diff)
downloadmixlib-shellout-e3357fc180bdd3a21da15b54d8e6daef33c309e1.tar.gz
Only close handles that are set to a valid handle value
-rw-r--r--lib/mixlib/shellout/windows/core_ext.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/mixlib/shellout/windows/core_ext.rb b/lib/mixlib/shellout/windows/core_ext.rb
index e692c7d..e7b8ac8 100644
--- a/lib/mixlib/shellout/windows/core_ext.rb
+++ b/lib/mixlib/shellout/windows/core_ext.rb
@@ -346,9 +346,9 @@ module Process
# Automatically close the process and thread handles in the
# PROCESS_INFORMATION struct unless explicitly told not to.
if hash['close_handles']
- CloseHandle(procinfo[:hProcess])
- CloseHandle(procinfo[:hThread])
- CloseHandle(token)
+ CloseHandle(procinfo[:hProcess]) if procinfo[:hProcess]
+ CloseHandle(procinfo[:hThread]) if procinfo[:hThread]
+ CloseHandle(token) if token
end
ProcessInfo.new(