mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 06:25:31 +02:00
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
This commit is contained in:
parent
5da2f77b93
commit
5be3869221
2 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue