Skip to content

Instantly share code, notes, and snippets.

@mrkplt
Created December 16, 2013 19:52
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 mrkplt/7993228 to your computer and use it in GitHub Desktop.
Save mrkplt/7993228 to your computer and use it in GitHub Desktop.
A lil script for playing with signal trapping on *nix machines.
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