summaryrefslogtreecommitdiff
path: root/spec/mixlib/shellout_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mixlib/shellout_spec.rb')
-rw-r--r--spec/mixlib/shellout_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb
index 42f2714..03bb47b 100644
--- a/spec/mixlib/shellout_spec.rb
+++ b/spec/mixlib/shellout_spec.rb
@@ -843,6 +843,25 @@ describe Mixlib::ShellOut do
end
end
+ context "when the child process dies immediately" do
+ let(:cmd) { [ 'exit' ] }
+
+ it "handles ESRCH from getpgid of a zombie" do
+ 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.
+ 5.times do
+ s = Mixlib::ShellOut.new(cmd)
+ s.run_command # should not raise Errno::ESRCH
+ end
+
+ end
+
+ end
+
context 'with subprocess that takes longer than timeout' do
def ruby_wo_shell(code)
parts = %w[ruby]