summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-02-20 10:05:40 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-02-20 10:05:40 +0100
commit55d813a827624a2385e798ea61aff672241af0bd (patch)
treece57dec5d6b6be50f6d2eac3c318f3c5d642d192
parent4701782cbb133d6c07ceacdd8d1158d75166b0cb (diff)
downloadtrollius-55d813a827624a2385e798ea61aff672241af0bd.tar.gz
asyncio.subprocess: Fix a race condition in communicate()
Use self._loop instead of self._transport._loop, because transport._loop is set to None at process exit.
-rw-r--r--asyncio/subprocess.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/asyncio/subprocess.py b/asyncio/subprocess.py
index c3b0175..414e023 100644
--- a/asyncio/subprocess.py
+++ b/asyncio/subprocess.py
@@ -146,7 +146,6 @@ class Process:
@tasks.coroutine
def communicate(self, input=None):
- loop = self._transport._loop
if input:
stdin = self._feed_stdin(input)
else:
@@ -160,7 +159,7 @@ class Process:
else:
stderr = self._noop()
stdin, stdout, stderr = yield from tasks.gather(stdin, stdout, stderr,
- loop=loop)
+ loop=self._loop)
yield from self.wait()
return (stdout, stderr)