]> granicus.if.org Git - python/commitdiff
Issue #23242: asyncio.SubprocessStreamProtocol now closes the subprocess
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 15 Jan 2015 12:16:02 +0000 (13:16 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 15 Jan 2015 12:16:02 +0000 (13:16 +0100)
transport at subprocess exit.

Clear also its reference to the transport.

Lib/asyncio/subprocess.py

index a028339c886608e94db5c8aa70b8e9d1d87b9ce6..c848a21a8f26d229909a490c1f0c242322bb52f6 100644 (file)
@@ -94,8 +94,11 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
                 reader.set_exception(exc)
 
     def process_exited(self):
-        # wake up futures waiting for wait()
         returncode = self._transport.get_returncode()
+        self._transport.close()
+        self._transport = None
+
+        # wake up futures waiting for wait()
         while self._waiters:
             waiter = self._waiters.popleft()
             if not waiter.cancelled():