Skip to content

Commit

Permalink
improve error reporting when spawnProcess raises
Browse files Browse the repository at this point in the history
glyph committed Mar 21, 2023
1 parent 1278640 commit 2c001a9
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/twisted/internet/test/test_process.py
Original file line number Diff line number Diff line change
@@ -446,14 +446,20 @@ def processEnded(self, reason):

reactor = self.buildReactor()

reactor.callWhenRunning(
reactor.spawnProcess,
GatheringProtocol(),
pyExe,
[pyExe, b"-Wignore", b"-c", source],
env=properEnv,
usePTY=self.usePTY,
)
def doSpawn() -> None:
try:
reactor.spawnProcess(
GatheringProtocol(),
pyExe,
[pyExe, b"-Wignore", b"-c", source],
env=properEnv,
usePTY=self.usePTY,
)
except BaseException:
err()
reactor.stop()

reactor.callWhenRunning(doSpawn)

self.runReactor(reactor)
reportedChildFDs = set(eval(output.getvalue()))

0 comments on commit 2c001a9

Please sign in to comment.