diff options
| author | Luke Kanies <luke@madstop.com> | 2008-08-18 19:15:24 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-08-18 19:15:24 -0500 |
| commit | d24504e83acd0bf210fb643d6c9f0cc2e6eae6c0 (patch) | |
| tree | 3e2d4ba63ba0180536a0c906c7fed0cc83527cfc /spec | |
| parent | bd87aa049a4ea831e9bdc130e5134b4e4e5a8387 (diff) | |
Added a Process.waitall thread when there's a timeout, to avoid zombies.
Without this call, every time there's a timeout, we'll get a zombie.
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/util/resolution.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/unit/util/resolution.rb b/spec/unit/util/resolution.rb index 5ce3d63..643be33 100755 --- a/spec/unit/util/resolution.rb +++ b/spec/unit/util/resolution.rb @@ -112,6 +112,17 @@ describe Facter::Util::Resolution do @resolve.value.should be_nil end + + it "should waitall to avoid zombies if the timeout is exceeded" do + @resolve.stubs(:warn) + @resolve.timeout = 0.1 + @resolve.setcode { sleep 2; raise "This is a test" } + + Thread.expects(:new).yields + Process.expects(:waitall) + + @resolve.value + end end end |
