-
-
Save tombruijn/a4181e217b8e1c46ebcc2c116223cb6a to your computer and use it in GitHub Desktop.
SignalException rescue example
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 | |
# $ ruby signal.rb | |
# $ kill -QUIT [pid] | |
puts "Process pid: #{Process.pid}" | |
puts "I will exit automatically after 50 seconds." | |
i = 0 | |
loop do | |
i += 1 | |
begin | |
sleep 5 | |
rescue SignalException => e | |
puts e.inspect | |
end | |
exit if i > 10 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment