From 4af243a8afa0dfefc74bb68dd08d9c5ff3ccc5d5 Mon Sep 17 00:00:00 2001 From: mame Date: Tue, 27 Apr 2010 12:27:13 +0000 Subject: * eval.c (ruby_cleanup): before cleanup, check signal buffer and run handler if any. [ruby-core:20970] * thread.c (rb_threadptr_check_signal): separeted from timer_thread_function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_signal.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test') 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 -- cgit v1.2.3