summaryrefslogtreecommitdiff
path: root/spec/ruby/core/signal/fixtures/trap_all.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-06-27 21:02:36 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-06-27 21:02:36 +0200
commitd80e44deec77678fe2d72f94c17b2409b3e794d5 (patch)
tree612bf2313550e0982dda452f48492cc069e1c21a /spec/ruby/core/signal/fixtures/trap_all.rb
parentc940397116c5aef76b1c0d05561c11d43ef596a7 (diff)
Update to ruby/spec@8d74d49
Diffstat (limited to 'spec/ruby/core/signal/fixtures/trap_all.rb')
-rw-r--r--spec/ruby/core/signal/fixtures/trap_all.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/ruby/core/signal/fixtures/trap_all.rb b/spec/ruby/core/signal/fixtures/trap_all.rb
index b2e85df247..afa00b498d 100644
--- a/spec/ruby/core/signal/fixtures/trap_all.rb
+++ b/spec/ruby/core/signal/fixtures/trap_all.rb
@@ -1,8 +1,15 @@
-reserved_signals = ARGV
+cannot_be_trapped = %w[KILL STOP] # See man 2 signal
-(Signal.list.keys - reserved_signals).each do |signal|
- Signal.trap(signal, -> {})
- Signal.trap(signal, "DEFAULT")
+(Signal.list.keys - cannot_be_trapped).each do |signal|
+ begin
+ Signal.trap(signal, -> {})
+ rescue ArgumentError => e
+ unless /can't trap reserved signal|Signal already used by VM or OS/ =~ e.message
+ raise e
+ end
+ else
+ Signal.trap(signal, "DEFAULT")
+ end
end
puts "OK"