diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2014-01-29 12:32:35 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2014-01-29 12:32:35 +0100 |
| commit | 19eba42b8e564009eb02fbab87b314f9b07abbde (patch) | |
| tree | 33de40428652f7b7e411faa253aa9e9af512e744 | |
| parent | f6ffa0eb6eebb57866bd8ad252fe0bafba1fb79b (diff) | |
| download | trollius-19eba42b8e564009eb02fbab87b314f9b07abbde.tar.gz | |
Add a returncode attribute
| -rw-r--r-- | asyncio/subprocess_streams.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/asyncio/subprocess_streams.py b/asyncio/subprocess_streams.py index cedf582..37e7655 100644 --- a/asyncio/subprocess_streams.py +++ b/asyncio/subprocess_streams.py @@ -21,6 +21,7 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, self._transport = None self._dead = False self.pid = None + self.returncode = None def connection_made(self, transport): self._transport = transport @@ -71,17 +72,16 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, self._dead = True # wake up futures waiting for wait() - returncode = self._transport.get_returncode() + self.returncode = self._transport.get_returncode() while self._waiters: waiter = self._waiters.popleft() - waiter.set_result(returncode) + waiter.set_result(self.returncode) @tasks.coroutine def wait(self): """Wait until the process exit and return the process return code.""" - returncode = self._transport.get_returncode() - if returncode is not None: - return returncode + if self.returncode is not None: + return self.returncode waiter = futures.Future() self._waiters.append(waiter) |
