From 765ffc8047b8f7c83d386150c3c8eab3f438e9a1 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 15 May 2015 07:21:15 -0700 Subject: remove getpgrp back to setsid --- spec/mixlib/shellout_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'spec') diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb index 1765026..75d9821 100644 --- a/spec/mixlib/shellout_spec.rb +++ b/spec/mixlib/shellout_spec.rb @@ -1013,15 +1013,15 @@ describe Mixlib::ShellOut do let(:cmd) { [ 'exit' ] } it "handles ESRCH from getpgid of a zombie", :unix_only do - Process.stub(:setpgrp) { exit!(4) } + Process.stub(:setsid) { exit!(4) } - # there is a small race condition here if the child doesn't get - # scheduled and call exit! before the parent can call getpgid, so run - # this a few times to make sure we've created the reproduction case - # correctly. + # we used to have race conditions if the child exited and zombied + # quickly which would cause an exception. we no longer call getpgrp() + # after setsid()/setpgrp() though so this race condition should no + # longer exist. still test 5 times for it though. 5.times do s = Mixlib::ShellOut.new(cmd) - s.run_command # should not raise Errno::ESRCH + s.run_command # should not raise Errno::ESRCH (or anything else) end end -- cgit v1.2.1