Skip to content

Instantly share code, notes, and snippets.

@andrewvc
Created September 16, 2010 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewvc/583415 to your computer and use it in GitHub Desktop.
Save andrewvc/583415 to your computer and use it in GitHub Desktop.
#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