opscode/ohai — pull request #154 by danielsdeleo (2013-06-26 21:58:04+00:00)
Title: Reap processes and close fds when exec fails

Fixes OHAI-455: http://tickets.opscode.com/browse/OHAI-455

I used this script to reproduce the issue:
```

require 'rubygems'
$:.unshift File.expand_path 'lib'
require 'ohai/mixin/command'

spawned_count = 0
100.times do
begin
Ohai::Mixin::Command.popen4("/usr/bin/not-a-thing") do |pid, stdin, stdout, stderr|
# blah
end
rescue Ohai::Exceptions::Exec
spawned_count += 1
end
end

puts "spawned #{spawned_count} zombies"

count = 0
begin
loop do
Process.wait(-1)
count += 1
end
rescue Errno::ECHILD
end

puts "reaped #{count} zombiez"
```