Created
October 26, 2017 23:57
-
-
Save jhargis/66871966f46086333d33a66b409a4365 to your computer and use it in GitHub Desktop.
simple signal handler example
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
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