Created
February 24, 2011 16:37
-
-
Save thattommyhall/842404 to your computer and use it in GitHub Desktop.
Playing with signals in Ruby
This file contains hidden or 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
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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
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