Monday, March 22, 2010

python twisted interrupt signal handler


from twisted.internet import reactor
import signal
def shutdown(*f):
sig, ob = f
if sig == signal.SIGINT: reactor.stop() #shutdown the reactor if Ctrl-C enter.

signal.signal(signal.SIGINT, shutdown)
reator.run(installSignalHandlers=0)

No comments:

Post a Comment