summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-06-26 14:54:48 -0700
committerdanielsdeleo <dan@opscode.com>2013-06-26 17:50:12 -0700
commit82d86afbe6651c23160c9754b3c17b2dd78d5aa0 (patch)
treef681032c0c0f32bccb6ee0f6bddb0a83bd09fa15 /lib
parent4028eb336612d410d9cc5ff4c666b428bd3ff684 (diff)
downloadohai-82d86afbe6651c23160c9754b3c17b2dd78d5aa0.tar.gz
Reap processes and close fds when exec fails
Fixes OHAI-455: http://tickets.opscode.com/browse/OHAI-455
Diffstat (limited to 'lib')
-rw-r--r--lib/ohai/mixin/command.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ohai/mixin/command.rb b/lib/ohai/mixin/command.rb
index 4487e3bf..a719e274 100644
--- a/lib/ohai/mixin/command.rb
+++ b/lib/ohai/mixin/command.rb
@@ -224,6 +224,10 @@ module Ohai
begin
e = Marshal.load ps.first
+ pw.last.close
+ pr.first.close
+ pe.first.close
+ Process.wait(cid)
raise(Exception === e ? e : "unknown failure!")
rescue EOFError # If we get an EOF error, then the exec was successful
42