Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 21 lines (15 sloc) 296 Bytes
#!/usr/bin/python
import time
import signal
class CaughtSignal(Exception):
pass
def foo():
try:
while True:
time.sleep(1)
except CaughtSignal:
print "caught signal"
def handler(s, f):
raise CaughtSignal
signal.signal(signal.SIGINT, handler)
foo()