Created
February 3, 2016 08:47
-
-
Save branch14/abe24d25e815fc1045ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
Signal.list.each do |signal, number| | |
begin | |
print "trapping % -6s ..." % signal | |
Signal.trap(signal) do | |
puts 'caught ' + signal | |
exit | |
end | |
puts 'ok.' | |
rescue | |
puts 'reserved.' | |
end | |
end | |
puts 'Enter endless loop.' | |
loop { sleep 1 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment