Commit 4bf22e03 authored by Victor Stinner's avatar Victor Stinner

asyncio: Close the transport on subprocess creation failure

parent fcd58de7
......@@ -177,7 +177,11 @@ class _UnixSelectorEventLoop(selector_events.BaseSelectorEventLoop):
transp = _UnixSubprocessTransport(self, protocol, args, shell,
stdin, stdout, stderr, bufsize,
extra=extra, **kwargs)
yield from transp._post_init()
try:
yield from transp._post_init()
except:
transp.close()
raise
watcher.add_child_handler(transp.get_pid(),
self._child_watcher_callback, transp)
......
......@@ -272,7 +272,12 @@ class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
transp = _WindowsSubprocessTransport(self, protocol, args, shell,
stdin, stdout, stderr, bufsize,
extra=extra, **kwargs)
yield from transp._post_init()
try:
yield from transp._post_init()
except:
transp.close()
raise
return transp
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment