summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-11-25 16:20:33 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-11-25 16:20:33 (GMT)
commit5ef586f25a6d5128a15341e849d7dca4fe882d22 (patch)
tree9e43ac203681b77b372d408d83fd0b97a5cc85a1 /Lib/asyncio
parentc8c64e30e889c04ce266bf9e49d58cb97d835329 (diff)
downloadcpython-5ef586f25a6d5128a15341e849d7dca4fe882d22.zip
cpython-5ef586f25a6d5128a15341e849d7dca4fe882d22.tar.gz
cpython-5ef586f25a6d5128a15341e849d7dca4fe882d22.tar.bz2
Closes #22685, asyncio: Set the transport of stdout and stderr StreamReader
objects in the SubprocessStreamProtocol. It allows to pause the transport to not buffer too much stdout or stderr data.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/subprocess.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py
index e4c1499..f6d6a14 100644
--- a/Lib/asyncio/subprocess.py
+++ b/Lib/asyncio/subprocess.py
@@ -41,15 +41,22 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
def connection_made(self, transport):
self._transport = transport
- if transport.get_pipe_transport(1):
+
+ stdout_transport = transport.get_pipe_transport(1)
+ if stdout_transport is not None:
self.stdout = streams.StreamReader(limit=self._limit,
loop=self._loop)
- if transport.get_pipe_transport(2):
+ self.stdout.set_transport(stdout_transport)
+
+ stderr_transport = transport.get_pipe_transport(2)
+ if stderr_transport is not None:
self.stderr = streams.StreamReader(limit=self._limit,
loop=self._loop)
- stdin = transport.get_pipe_transport(0)
- if stdin is not None:
- self.stdin = streams.StreamWriter(stdin,
+ self.stderr.set_transport(stderr_transport)
+
+ 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)