]> granicus.if.org Git - python/commitdiff
asyncio: Fix repr(BaseSubprocessTransport) if it didn't start yet
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 10 Mar 2015 15:32:29 +0000 (16:32 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 10 Mar 2015 15:32:29 +0000 (16:32 +0100)
Replace "running" with "not started" and don't show the pid if the subprocess
didn't start yet.

Lib/asyncio/base_subprocess.py

index c1cdfda75449448563527e396e82a9b9a62e80fc..d18f3e8f07c2ce5d4a752f00d791897baf4cf36b 100644 (file)
@@ -54,11 +54,14 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
         info = [self.__class__.__name__]
         if self._closed:
             info.append('closed')
-        info.append('pid=%s' % self._pid)
+        if self._pid is not None:
+            info.append('pid=%s' % self._pid)
         if self._returncode is not None:
             info.append('returncode=%s' % self._returncode)
-        else:
+        elif self._pid is not None:
             info.append('running')
+        else:
+            info.append('not started')
 
         stdin = self._pipes.get(0)
         if stdin is not None: