summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 18:47:14 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 18:47:14 +0000
commit5be3869221b83b7f3f08854cefdb59f279d74bde (patch)
treee55589178623f5c3a910285a58ddfc9ccb5ccdb4 /test/ruby/test_process.rb
parent5da2f77b93e0abd17ad9bf3c4ba6d843b0e0a86d (diff)
process: block/unblock signals around fork
As with forking for execve(2) in `spawn', we must block signals to ensure they are handled correctly in a freshly `fork'-ed child. * process.c (retry_fork_ruby): block/unblock signals around fork (rb_fork_ruby): re-enable signals in forked child * test/ruby/test_process.rb (test_forked_child_signal): new test [ruby-core:82883] [Bug #13916] Thanks to Russell Davis for the bug report and test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index d8b55b35c1..7bd38c8fed 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -2329,4 +2329,14 @@ EOS
end
end
end
+
+ def test_forked_child_handles_signal
+ skip "fork not supported" unless Process.respond_to?(:fork)
+ assert_normal_exit(<<-"end;", '[ruby-core:82883] [Bug #13916]')
+ require 'timeout'
+ pid = fork { sleep }
+ Process.kill(:TERM, pid)
+ assert_equal pid, Timeout.timeout(30) { Process.wait(pid) }
+ end;
+ end
end