From 8405551e6d05c08c4e6a25672e009d349d888aa1 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 20 Oct 2003 02:31:47 +0000 Subject: * test/ruby/test_signal.rb (test_signal): restore old trap. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_signal.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/ruby') diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb index 61240cd65d..77c97be98c 100644 --- a/test/ruby/test_signal.rb +++ b/test/ruby/test_signal.rb @@ -4,9 +4,10 @@ $KCODE = 'none' class TestSignal < Test::Unit::TestCase def test_signal - if defined? Process.kill + defined?(Process.kill) or return + begin $x = 0 - trap "SIGINT", proc{|sig| $x = 2} + oldtrap = trap "SIGINT", proc{|sig| $x = 2} Process.kill "SIGINT", $$ sleep 0.1 assert_equal(2, $x) @@ -19,6 +20,8 @@ class TestSignal < Test::Unit::TestCase end assert(x) assert_match(/Interrupt/, x.message) + ensure + trap "SIGINT", oldtrap end end end -- cgit v1.2.3