Skip to content

Instantly share code, notes, and snippets.

@branch14
Created February 3, 2016 08:47
Show Gist options
  • Save branch14/abe24d25e815fc1045ab to your computer and use it in GitHub Desktop.
Save branch14/abe24d25e815fc1045ab to your computer and use it in GitHub Desktop.
#!/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