I'm in the process of porting code from Twisted 8.1 to 10.1 which needed some custom signal handling code. Twisted 8.1's approach to signal handling was (as far as we could tell) too monolithic, so we chose "installSignalHandlers=False" and wrote our own signal handling code, installing reactor._handleSigchld so that spawnProcess would work. Of course, we have to change this now since #733 was fixed (<a href="http://twistedmatrix.com/trac/ticket/733">http://twistedmatrix.com/trac/ticket/733</a>).<div>
<br></div><div>IIUC, (and please correct if I don't) the SIGCHLD handler installation is performed by twisted.internet.posixbase.PosixReactorBase._handleSignals (the "if platformType == 'posix':" block). So, one option would be to run that code while still using "installSignalHandlers=False".</div>
<div><br></div><div>I'm wondering if there's a better way. What if I were to let Twisted install signal handlers, but run my own signal handling code after the reactor starts (using callLater(0,...)) that installs "super" handlers which calls the Twisted handler along with any other handlers I want to run. I'd use signal.getsignal to get a reference to the Twisted handler(s). Might this work? Or, is there an obvious flaw? In particular, can I get the SIGCHLD handler using signal.getsignal, then call it via my "super" handler? I don't need to do any special handling of SIGCHLD, so I could just leave that signal handler alone.</div>
<div><br></div><div>All thoughts appreciated.</div><div><br>Thanks,</div><div><br>Jason<br clear="all"><br>-- <br>Jason Rennie<br>Research Scientist, ITA Software<br>617-714-2645<br><a href="http://www.itasoftware.com/" target="_blank">http://www.itasoftware.com/</a><br>
<br>
</div>