def _handleSignals(self): # Let the base class do its thing, but pygtk is probably # going to stomp on us so go beyond that and set up some # signal handling which pygtk won't mess with. This would # be better done by letting this reactor select a # different implementation of installHandler for # _SIGCHLDWaker to use. Then, at least, we could fall # back to our extension module. See #4286. from twisted.internet.process import reapAllProcesses as _reapAllProcesses base._SignalReactorMixin._handleSignals(self) signal.signal(signal.SIGCHLD, lambda *a: self.callFromThread(_reapAllProcesses)) if getattr(signal, "siginterrupt", None) is not None: signal.siginterrupt(signal.SIGCHLD, False) # Like the base, reap processes now in case a process # exited before the handlers above were installed. _reapAllProcesses()