Skip to content

Instantly share code, notes, and snippets.

@thattommyhall
Created February 24, 2011 16:37
Show Gist options
  • Save thattommyhall/842404 to your computer and use it in GitHub Desktop.
Save thattommyhall/842404 to your computer and use it in GitHub Desktop.
Playing with signals in Ruby
puts "I have PID #{Process.pid}"
Signal.trap("USR1") {puts "prodded me"}
loop do
begin
puts "doing stuff"
sleep 10
rescue Exception => e
puts e.inspect
end
end
puts "I have PID #{Process.pid}"
Signal.trap("USR1") {puts "prodded me"}
loop do
begin
puts "doing stuff"
sleep 10
rescue => e
puts e.inspect
end
end
puts "I have PID #{Process.pid}"
Signal.trap("USR1") {puts "prodded me"}
loop do
sleep 10
puts "doing stuff"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment