Created
December 16, 2013 19:52
-
-
Save mrkplt/7993228 to your computer and use it in GitHub Desktop.
A lil script for playing with signal trapping on *nix machines.
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
hello = 'Hello' | |
puts Process.pid | |
while true | |
Signal.trap('USR1'){ | |
hello = 'HALLO!' | |
} | |
Signal.trap('USR2'){ | |
hello = 'Hello' | |
} | |
Signal.trap('INT'){ | |
puts 'Exiting...' | |
exit | |
} | |
puts hello | |
sleep 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment