diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-20 02:31:47 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-20 02:31:47 +0000 |
commit | 8405551e6d05c08c4e6a25672e009d349d888aa1 (patch) | |
tree | d989d2622158ca9fea10eff9fc085fa8d113f4a5 /test/ruby | |
parent | de6f26a2966f9862598e0233b480093bf8c5588d (diff) |
* 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
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_signal.rb | 7 |
1 files changed, 5 insertions, 2 deletions
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 |