
Hi Gabriel, On Wed, Feb 4, 2009 at 10:15 AM, Gabriel Rossetti <gabriel.rossetti@arimaz.com> wrote:
Hello everyone,
I would like to run some cleanup code when my Twisted app receives a signal (SIGINT/SIGBREAK/SIGTERM).
I saw that "_SignalReactorMixin" sets the handlers and that "ReactorBase" defines the default handlers : ... My question is how can I redefine them, other than monkey patching or inheriting the reactor and over-riding them (which I'd rather not do since some of my code uses the windows reactor when on windows since I was having problems with windows event)? Is there such a mechanism, something like setDefaultSig("SIGINT, mySigIntHandler)?
One easy way to do it is to reactor.run(installSignalHandlers=False) and then manually install your own signal handlers in the usual way (using the python signal library). Cheers, Reza -- Reza Lotun Senior Software Engineer Peer Technologies Limited reza@getpeer.com