1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2018-08-27 14:25:00 +00:00
parent a641384815
commit 8180b5bfc0
54 changed files with 606 additions and 111 deletions

View file

@ -158,9 +158,28 @@ platform_is_not :windows do
$?.exitstatus.should == 0
end
it "returns 'DEFAULT' for the initial SIGINT handler" do
ruby_exe('print trap(:INT) { abort }').should == 'DEFAULT'
end
it "returns SYSTEM_DEFAULT if passed DEFAULT and no handler was ever set" do
Signal.trap("PROF", "DEFAULT").should == "SYSTEM_DEFAULT"
end
it "accepts 'SYSTEM_DEFAULT' and uses the OS handler for SIGPIPE" do
code = <<-RUBY
p Signal.trap('PIPE', 'SYSTEM_DEFAULT')
r, w = IO.pipe
r.close
loop { w.write("a"*1024) }
RUBY
out = ruby_exe(code)
status = $?
out.should == "nil\n"
status.signaled?.should == true
status.termsig.should be_kind_of(Integer)
Signal.signame(status.termsig).should == "PIPE"
end
end
end