mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/timeout] Restore original signal handler in test_timeout_in_trap_handler
https://github.com/ruby/timeout/commit/4ae8631acf
This commit is contained in:
parent
d9cc7621f3
commit
175a0d5f1a
@ -427,9 +427,9 @@ class TestTimeout < Test::Unit::TestCase
|
||||
|
||||
rd, wr = IO.pipe
|
||||
|
||||
signal = Signal.list["USR1"] ? :USR1 : :TERM
|
||||
signal = :TERM
|
||||
|
||||
trap(signal) do
|
||||
original_handler = trap(signal) do
|
||||
begin
|
||||
Timeout.timeout(0.1) do
|
||||
sleep 1
|
||||
@ -444,9 +444,13 @@ class TestTimeout < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
Process.kill signal, Process.pid
|
||||
begin
|
||||
Process.kill signal, Process.pid
|
||||
|
||||
assert_equal "OK", rd.read
|
||||
rd.close
|
||||
assert_equal "OK", rd.read
|
||||
rd.close
|
||||
ensure
|
||||
trap(signal, original_handler)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user