Created
January 18, 2012 17:14
-
-
Save stephenpaulger/1634184 to your computer and use it in GitHub Desktop.
SIGQUIT handler
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
import signal | |
import sys | |
import time | |
def handle(sig, frame): | |
print all_signals[sig] | |
all_signals = dict((getattr(signal, attr), attr) for attr in dir(signal) if attr.startswith("SIG")) | |
for i in all_signals.keys(): | |
try: | |
signal.signal(i, handle) | |
except RuntimeError: | |
print "Skipping %d, RuntimeError" % i | |
except ValueError: | |
print "Skipping %d, ValueError" % i | |
time.sleep(2000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment