Skip to content

Instantly share code, notes, and snippets.

@stephenpaulger
Created January 18, 2012 17:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephenpaulger/1634184 to your computer and use it in GitHub Desktop.
Save stephenpaulger/1634184 to your computer and use it in GitHub Desktop.
SIGQUIT handler
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