Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions test/test_timeout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ def test_timeout_in_trap_handler

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
Expand All @@ -444,9 +444,13 @@ def test_timeout_in_trap_handler
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