diff options
Diffstat (limited to 'test/ruby/test_signal.rb')
-rw-r--r-- | test/ruby/test_signal.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb index 1ecf5401ab..5d9d3cd691 100644 --- a/test/ruby/test_signal.rb +++ b/test/ruby/test_signal.rb @@ -36,7 +36,7 @@ class TestSignal < Test::Unit::TestCase end def test_exit_action - return unless have_fork? # snip this test + return unless have_fork? # skip this test begin r, w = IO.pipe r0, w0 = IO.pipe @@ -166,4 +166,17 @@ class TestSignal < Test::Unit::TestCase Signal.trap(:INT, oldtrap) if oldtrap end end + + def test_kill_immediately_before_termination + return unless have_fork? # skip this test + + r, w = IO.pipe + pid = Process.fork do + r.close + Signal.trap(:USR1) { w.syswrite("foo") } + Process.kill :USR1, $$ + end + w.close + assert_equal(r.read, "foo") + end end |