Created
September 16, 2010 23:59
-
-
Save andrewvc/583415 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
#Rescuing Exceptions is bad... use StandardError. | |
#Exception catches some signals, like SIGINT if there's no trap for them. Probably not what you want. | |
trap("TERM") { | |
puts "Received Term" | |
} | |
begin | |
puts "Sleeping" | |
puts Process.pid | |
sleep 20 | |
rescue Exception => e | |
puts "Rescued #{e}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment