Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
SignalException rescue example
#!/usr/bin/env ruby
# $ ruby signal.rb
# $ kill -QUIT [pid]
puts "Process pid: #{}"
puts "I will exit automatically after 50 seconds."
i = 0
loop do
i += 1
sleep 5
rescue SignalException => e
puts e.inspect
exit if i > 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment