Skip to content

Commit 67a39bd

Browse files
committed
Add spec that register a new signal handler after :IGNORE works
1 parent cea8768 commit 67a39bd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

spec/ruby/core/signal/trap_spec.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@
5252
Process.kill(:HUP, Process.pid).should == 1
5353
end
5454

55+
it "can register a new handler after :IGNORE" do
56+
Signal.trap :HUP, :IGNORE
57+
Process.kill(:HUP, Process.pid).should == 1
58+
59+
done = false
60+
Signal.trap(:HUP) do
61+
ScratchPad.record :block_trap
62+
done = true
63+
end
64+
65+
Process.kill(:HUP, Process.pid).should == 1
66+
Thread.pass until done
67+
ScratchPad.recorded.should == :block_trap
68+
end
69+
5570
it "ignores the signal when passed nil" do
5671
Signal.trap :HUP, nil
5772
Signal.trap(:HUP, @saved_trap).should be_nil

0 commit comments

Comments
 (0)