diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-01-27 00:12:01 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-01-27 00:12:01 +0100 |
commit | cf89b14fc3e56223f6c06cd1448d12e1051fac28 (patch) | |
tree | cd020def1cd0f35c2030b922b4a2749d20d9d895 | |
parent | 4012c6a89a485d3587807373a95aca16d1e51dcd (diff) | |
download | trollius-cf89b14fc3e56223f6c06cd1448d12e1051fac28.tar.gz |
Remove the artificial _pipe_connection_made() method
-rw-r--r-- | asyncio/base_subprocess.py | 4 | ||||
-rw-r--r-- | asyncio/subprocess_stream.py | 23 |
2 files changed, 10 insertions, 17 deletions
diff --git a/asyncio/base_subprocess.py b/asyncio/base_subprocess.py index 2f7f565..14ae18a 100644 --- a/asyncio/base_subprocess.py +++ b/asyncio/base_subprocess.py @@ -163,9 +163,6 @@ class BaseSubprocessTransport(SubprocessTransport): self._loop.call_soon(callback, *data) self._pending_calls = None - def _pipe_connection_made(self, fd, pipe): - self._protocol.pipe_connection_made(fd, pipe) - def _pipe_connection_lost(self, fd, exc): self._call(self._protocol.pipe_connection_lost, fd, exc) self._try_finish() @@ -213,7 +210,6 @@ class WriteSubprocessPipeProto(protocols.BaseProtocol): self.connected = True self.pipe = transport self.proc._try_connected() - self.proc._pipe_connection_made(self.fd, self) def connection_lost(self, exc): self.disconnected = True diff --git a/asyncio/subprocess_stream.py b/asyncio/subprocess_stream.py index ec80330..ff22f8f 100644 --- a/asyncio/subprocess_stream.py +++ b/asyncio/subprocess_stream.py @@ -141,12 +141,18 @@ class SubprocessStreamProtocol(protocols.SubprocessProtocol): self._transport = None def create_read_pipe_protocol(self, transport, fd): - protocol = ReadSubprocessPipeStreamProto(transport, fd, self.limit) - self.pipe_connection_made(fd, protocol) - return protocol + pipe = ReadSubprocessPipeStreamProto(transport, fd, self.limit) + if fd == 1: + self.stdout = pipe._stream_reader + elif fd == 2: + self.stderr = pipe._stream_reader + return pipe def create_write_pipe_protocol(self, transport, fd): - return WriteSubprocessPipeStreamProto(transport, fd) + pipe = WriteSubprocessPipeStreamProto(transport, fd) + if fd == 0: + self.stdin = pipe.writer + return pipe def connection_made(self, transport): self._transport = transport @@ -180,12 +186,3 @@ class SubprocessStreamProtocol(protocols.SubprocessProtocol): self._waiters.clear() for waiter in waiters: waiter.set_result(returncode) - - def pipe_connection_made(self, fd, pipe): - self._pipes[fd] = pipe - if fd == 0: - self.stdin = pipe.writer - elif fd == 1: - self.stdout = pipe._stream_reader - elif fd == 2: - self.stderr = pipe._stream_reader |