'When a process terminates with a system exit code set to 1,
C{processEnded} is called with a L{error.ProcessTerminated} error,
the C{exitCode} attribute reflecting the system exit code.'

def test_abnormalTermination(self):

    d = defer.Deferred()
    p = TrivialProcessProtocol(d)
    reactor.spawnProcess(p, pyExe, [pyExe, '-c', 'import    sys;    sys.exit(1)'], env=None, usePTY=self.usePTY)
    def check(ignored):
        p.reason.trap(error.ProcessTerminated)
        self.assertEqual(p.reason.value.exitCode, 1)
        self.assertIsNone(p.reason.value.signal)
    d.addCallback(check)
    return d
