diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2019-05-07 20:53:19 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-05-07 20:53:19 (GMT) |
commit | 1cc0ee7d9f6a2817918fafd24c18d8bb093a85d3 (patch) | |
tree | 03a2e1f32fb51d8fc1c8e8ce8ebd64f672de8709 /Lib/asyncio/subprocess.py | |
parent | e19a91e45fd54a56e39c2d12e6aaf4757030507f (diff) | |
download | cpython-1cc0ee7d9f6a2817918fafd24c18d8bb093a85d3.zip cpython-1cc0ee7d9f6a2817918fafd24c18d8bb093a85d3.tar.gz cpython-1cc0ee7d9f6a2817918fafd24c18d8bb093a85d3.tar.bz2 |
bpo-36801: Fix waiting in StreamWriter.drain for closing SSL transport (GH-13098)
https://bugs.python.org/issue36801
Diffstat (limited to 'Lib/asyncio/subprocess.py')
-rw-r--r-- | Lib/asyncio/subprocess.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py index fa58e1e..d34b611 100644 --- a/Lib/asyncio/subprocess.py +++ b/Lib/asyncio/subprocess.py @@ -26,6 +26,7 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, self._transport = None self._process_exited = False self._pipe_fds = [] + self._stdin_closed = self._loop.create_future() def __repr__(self): info = [self.__class__.__name__] @@ -80,6 +81,10 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, if pipe is not None: pipe.close() self.connection_lost(exc) + if exc is None: + self._stdin_closed.set_result(None) + else: + self._stdin_closed.set_exception(exc) return if fd == 1: reader = self.stdout @@ -106,6 +111,10 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, self._transport.close() self._transport = None + def _get_close_waiter(self, stream): + if stream is self.stdin: + return self._stdin_closed + class Process: def __init__(self, transport, protocol, loop, *, _asyncio_internal=False): |