Skip to content

Instantly share code, notes, and snippets.

@jhargis
Created October 26, 2017 23:57
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 jhargis/66871966f46086333d33a66b409a4365 to your computer and use it in GitHub Desktop.
Save jhargis/66871966f46086333d33a66b409a4365 to your computer and use it in GitHub Desktop.
simple signal handler example
import sys
import signal
# custom signal handler
def signal_handler(signal, frame):
print 'Interrupt caught. Exiting.'
sys.exit(0)
# register
signal.signal(signal.SIGINT, signal_handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment