##// END OF EJS Templates
platform: implement readpipe()...
Gregory Szorc -
r22245:234e4c24 default
parent child Browse files
Show More
@@ -567,3 +567,16 def statislink(st):
567 567 def statisexec(st):
568 568 '''check whether a stat result is an executable file'''
569 569 return st and (st.st_mode & 0100 != 0)
570
571 def readpipe(pipe):
572 """Read all available data from a pipe."""
573 chunks = []
574 while True:
575 size = os.fstat(pipe.fileno()).st_size
576 if not size:
577 break
578
579 s = pipe.read(size)
580 if not s:
581 break
582 chunks.append(s)
@@ -103,13 +103,8 class sshpeer(wireproto.wirepeer):
103 103 return self._caps
104 104
105 105 def readerr(self):
106 while True:
107 size = util.fstat(self.pipee).st_size
108 if size == 0:
109 break
110 s = self.pipee.read(size)
111 if not s:
112 break
106 s = util.readpipe(self.pipee)
107 if s:
113 108 for l in s.splitlines():
114 109 self.ui.status(_("remote: "), l, '\n')
115 110
@@ -53,6 +53,7 pconvert = platform.pconvert
53 53 popen = platform.popen
54 54 posixfile = platform.posixfile
55 55 quotecommand = platform.quotecommand
56 readpipe = platform.readpipe
56 57 rename = platform.rename
57 58 samedevice = platform.samedevice
58 59 samefile = platform.samefile
@@ -336,3 +336,18 def statislink(st):
336 336 def statisexec(st):
337 337 '''check whether a stat result is an executable file'''
338 338 return False
339
340 def readpipe(pipe):
341 """Read all available data from a pipe."""
342 chunks = []
343 while True:
344 size = os.fstat(pipe.fileno()).st_size
345 if not size:
346 break
347
348 s = pipe.read(size)
349 if not s:
350 break
351 chunks.append(s)
352
353 return ''.join(chunks)
General Comments 0
You need to be logged in to leave comments. Login now