Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
22244:172036d60b22 | 22245:234e4c24b980 |
---|---|
101 | 101 |
102 def _capabilities(self): | 102 def _capabilities(self): |
103 return self._caps | 103 return self._caps |
104 | 104 |
105 def readerr(self): | 105 def readerr(self): |
106 while True: | 106 s = util.readpipe(self.pipee) |
107 size = util.fstat(self.pipee).st_size | 107 if s: |
108 if size == 0: | |
109 break | |
110 s = self.pipee.read(size) | |
111 if not s: | |
112 break | |
113 for l in s.splitlines(): | 108 for l in s.splitlines(): |
114 self.ui.status(_("remote: "), l, '\n') | 109 self.ui.status(_("remote: "), l, '\n') |
115 | 110 |
116 def _abort(self, exception): | 111 def _abort(self, exception): |
117 self.cleanup() | 112 self.cleanup() |