diff mercurial/sshpeer.py @ 22245:234e4c24b980

platform: implement readpipe() Reading all available data from a pipe has a platform-dependent implementation. This patch establishes platform.readpipe() by copying the inline implementation in sshpeer.readerr(). The implementations for POSIX and Windows are currently identical. The POSIX implementation will be changed in a subsequent patch.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 15 Aug 2014 20:02:18 -0700
parents 83ce71ef7804
children ee297602a208
line wrap: on
line diff
--- a/mercurial/sshpeer.py	Fri Aug 15 19:18:21 2014 -0700
+++ b/mercurial/sshpeer.py	Fri Aug 15 20:02:18 2014 -0700
@@ -103,13 +103,8 @@
         return self._caps
 
     def readerr(self):
-        while True:
-            size = util.fstat(self.pipee).st_size
-            if size == 0:
-                break
-            s = self.pipee.read(size)
-            if not s:
-                break
+        s = util.readpipe(self.pipee)
+        if s:
             for l in s.splitlines():
                 self.ui.status(_("remote: "), l, '\n')