summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/subprocess.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/asyncio/subprocess.py')
-rw-r--r--Lib/asyncio/subprocess.py35
1 files changed, 23 insertions, 12 deletions
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py
index d34b611..e6bec71 100644
--- a/Lib/asyncio/subprocess.py
+++ b/Lib/asyncio/subprocess.py
@@ -27,6 +27,8 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
self._process_exited = False
self._pipe_fds = []
self._stdin_closed = self._loop.create_future()
+ self._stdout_closed = self._loop.create_future()
+ self._stderr_closed = self._loop.create_future()
def __repr__(self):
info = [self.__class__.__name__]
@@ -40,30 +42,35 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
def connection_made(self, transport):
self._transport = transport
-
stdout_transport = transport.get_pipe_transport(1)
if stdout_transport is not None:
- self.stdout = streams.StreamReader(limit=self._limit,
- loop=self._loop,
- _asyncio_internal=True)
+ self.stdout = streams.Stream(mode=streams.StreamMode.READ,
+ transport=stdout_transport,
+ protocol=self,
+ limit=self._limit,
+ loop=self._loop,
+ _asyncio_internal=True)
self.stdout.set_transport(stdout_transport)
self._pipe_fds.append(1)
stderr_transport = transport.get_pipe_transport(2)
if stderr_transport is not None:
- self.stderr = streams.StreamReader(limit=self._limit,
- loop=self._loop,
- _asyncio_internal=True)
+ self.stderr = streams.Stream(mode=streams.StreamMode.READ,
+ transport=stderr_transport,
+ protocol=self,
+ limit=self._limit,
+ loop=self._loop,
+ _asyncio_internal=True)
self.stderr.set_transport(stderr_transport)
self._pipe_fds.append(2)
stdin_transport = transport.get_pipe_transport(0)
if stdin_transport is not None:
- self.stdin = streams.StreamWriter(stdin_transport,
- protocol=self,
- reader=None,
- loop=self._loop,
- _asyncio_internal=True)
+ self.stdin = streams.Stream(mode=streams.StreamMode.WRITE,
+ transport=stdin_transport,
+ protocol=self,
+ loop=self._loop,
+ _asyncio_internal=True)
def pipe_data_received(self, fd, data):
if fd == 1:
@@ -114,6 +121,10 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
def _get_close_waiter(self, stream):
if stream is self.stdin:
return self._stdin_closed
+ elif stream is self.stdout:
+ return self._stdout_closed
+ elif stream is self.stderr:
+ return self._stderr_closed
class Process: