about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2013-09-03 22:47:20 +0000
committerEric Wong <normalperson@yhbt.net>2013-09-03 23:35:16 +0000
commit71f656e40de99d240c873ebb23451f76e46e5a20 (patch)
tree7f6c6f12c11fe162bb16a9e1de3b0099624c54f5 /test
parent377028d998f32c9bf8926a275019445103328c3d (diff)
downloadkgio-71f656e40de99d240c873ebb23451f76e46e5a20.tar.gz
The existing SIGUSR1 handler may not always be "DEFAULT",
so restore the original one.
Diffstat (limited to 'test')
-rw-r--r--test/test_poll.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/test_poll.rb b/test/test_poll.rb
index 13f5f2a..5bfc70b 100644
--- a/test/test_poll.rb
+++ b/test/test_poll.rb
@@ -114,7 +114,7 @@ class TestPoll < Test::Unit::TestCase
     empty = 0
     nr = 100
     set = { @rd => Kgio::POLLIN }
-    trap(:USR1) { usr1 += 1 }
+    orig = trap(:USR1) { usr1 += 1 }
     pid = fork do
       trap(:USR1, "DEFAULT")
       sleep 0.1
@@ -129,6 +129,6 @@ class TestPoll < Test::Unit::TestCase
     assert status.success?, status.inspect
     assert usr1 > 0, "usr1: #{usr1}"
   ensure
-    trap(:USR1, "DEFAULT")
+    trap(:USR1, orig)
   end unless RUBY_PLATFORM =~ /kfreebsd-gnu/
 end if Kgio.respond_to?(:poll)