summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-05 15:42:20 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-05 15:42:20 +0000
commit93c833187c6e47c18b1cfafd5e1b9f682a43d482 (patch)
treeed75520dbe42668d9c18fa4b4a2a1e5f8896be0b /test/ruby
parentc2eabd831692e3e99d99ddbafd947e49711dfb13 (diff)
merge revision(s) 59975: [Backport #13916]
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/branches/ruby_2_4@62665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 f3d02f3bee..7301b45a9b 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -2328,4 +2328,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