'If a spawned process exits, C{processExited} will be called in a
timely manner.'

def test_timelyProcessExited(self):

    reactor = self.buildReactor()
    class ExitingProtocol(ProcessProtocol, ):
        exited = False
        def processExited(protoSelf, reason):
            protoSelf.exited = True
            reactor.stop()
            self.assertEqual(reason.value.exitCode, 0)
    protocol = ExitingProtocol()
    reactor.callWhenRunning(reactor.spawnProcess, protocol, pyExe, [pyExe, '-c', 'raise    SystemExit(0)'], usePTY=self.usePTY)
    self.runReactor(reactor, timeout=30)
    self.assertTrue(protocol.exited)
