##// END OF EJS Templates
platform: implement readpipe()...
Gregory Szorc -
r22245:234e4c24 default
parent child Browse files
Show More
@@ -567,3 +567,16 b' def statislink(st):'
567 def statisexec(st):
567 def statisexec(st):
568 '''check whether a stat result is an executable file'''
568 '''check whether a stat result is an executable file'''
569 return st and (st.st_mode & 0100 != 0)
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 b' class sshpeer(wireproto.wirepeer):'
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
@@ -53,6 +53,7 b' pconvert = platform.pconvert'
53 popen = platform.popen
53 popen = platform.popen
54 posixfile = platform.posixfile
54 posixfile = platform.posixfile
55 quotecommand = platform.quotecommand
55 quotecommand = platform.quotecommand
56 readpipe = platform.readpipe
56 rename = platform.rename
57 rename = platform.rename
57 samedevice = platform.samedevice
58 samedevice = platform.samedevice
58 samefile = platform.samefile
59 samefile = platform.samefile
@@ -336,3 +336,18 b' def statislink(st):'
336 def statisexec(st):
336 def statisexec(st):
337 '''check whether a stat result is an executable file'''
337 '''check whether a stat result is an executable file'''
338 return False
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