restart system calls on SIGCHLD signals (needed for OS X)

this only works in python >= 2.6.

--HG--
branch : trunk
This commit is contained in:
ralf@brainbot.com 2009-06-08 15:14:40 +02:00
parent a5d42b36d2
commit 58eba8a9a4
1 changed files with 12 additions and 1 deletions

View File

@ -44,6 +44,17 @@ def _run_twisted(logging=False):
failure.Failure.cleanFailure = lambda *args: None
if logging:
_start_twisted_logging()
def fix_signal_handling():
# see http://twistedmatrix.com/trac/ticket/733
import signal
if hasattr(signal, "siginterrupt"):
signal.siginterrupt(signal.SIGCHLD, False)
def start():
fix_signal_handling()
doit(None)
# recursively called for each test-function/method due done()
def doit(val): # val always None
# switch context to wait that wrapper() passes back to test-method
@ -64,7 +75,7 @@ def _run_twisted(logging=False):
# of doit()
defer.maybeDeferred(res).addCallback(done).addErrback(err)
# initially preparing the calling of doit() and starting the reactor
reactor.callLater(0.0, doit, None)
reactor.callLater(0.0, start)
reactor.run()
def pytest_addoption(parser):