diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-15 14:24:22 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-15 14:24:22 +0100 |
commit | 4bf22e033e975f61c33752db5a3764dc0f7d0b03 (patch) | |
tree | 268ed6b1243135e2b55cad6d59907a0ca33e5ae5 /Lib/asyncio/unix_events.py | |
parent | fcd58de78f72ca114707b78e448397d6dbe2ad5d (diff) | |
download | cpython-git-4bf22e033e975f61c33752db5a3764dc0f7d0b03.tar.gz |
asyncio: Close the transport on subprocess creation failure
Diffstat (limited to 'Lib/asyncio/unix_events.py')
-rw-r--r-- | Lib/asyncio/unix_events.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index 9f4005cb13..97f9addde8 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -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) |