changeset 22245 | 234e4c24b980 |
parent 20202 | a6014018ec28 |
child 22246 | 331cbf088c4c |
--- a/mercurial/posix.py Fri Aug 15 19:18:21 2014 -0700 +++ b/mercurial/posix.py Fri Aug 15 20:02:18 2014 -0700 @@ -567,3 +567,16 @@ def statisexec(st): '''check whether a stat result is an executable file''' return st and (st.st_mode & 0100 != 0) + +def readpipe(pipe): + """Read all available data from a pipe.""" + chunks = [] + while True: + size = os.fstat(pipe.fileno()).st_size + if not size: + break + + s = pipe.read(size) + if not s: + break + chunks.append(s)