Skip to content

Commit aadb128

Browse files
committed
Add extra spec for the default SIGINT handler raising Interrupt
1 parent ccd1f41 commit aadb128

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

spec/ruby/core/exception/interrupt_spec.rb

+16
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@
3333
end
3434
end
3535
end
36+
37+
describe "Interrupt" do
38+
# This spec is basically the same as above,
39+
# but it does not rely on Signal.trap(:INT, :SIG_DFL) which can be tricky
40+
it "is raised on the main Thread by the default SIGINT handler" do
41+
out = ruby_exe(<<-'RUBY', args: "2>&1")
42+
begin
43+
Process.kill :INT, Process.pid
44+
sleep
45+
rescue Interrupt => e
46+
puts "Interrupt: #{e.signo}"
47+
end
48+
RUBY
49+
out.should == "Interrupt: #{Signal.list["INT"]}\n"
50+
end
51+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
slow:Interrupt is raised on the main Thread by the default SIGINT handler

0 commit comments

Comments
 (0)