mercurial/utils/procutil.py
changeset 48946 642e31cb55f0
parent 48913 f254fc73d956
child 49084 ea98850a136e
equal deleted inserted replaced
48945:55d132525155 48946:642e31cb55f0
    57 
    57 
    58     def write(self, b):
    58     def write(self, b):
    59         raise IOError(errno.EBADF, 'Bad file descriptor')
    59         raise IOError(errno.EBADF, 'Bad file descriptor')
    60 
    60 
    61 
    61 
    62 class LineBufferedWrapper(object):
    62 class LineBufferedWrapper:
    63     def __init__(self, orig):
    63     def __init__(self, orig):
    64         self.orig = orig
    64         self.orig = orig
    65 
    65 
    66     def __getattr__(self, attr):
    66     def __getattr__(self, attr):
    67         return getattr(self.orig, attr)
    67         return getattr(self.orig, attr)
    96         assert not isinstance(stream.orig, LineBufferedWrapper)
    96         assert not isinstance(stream.orig, LineBufferedWrapper)
    97         return stream.orig
    97         return stream.orig
    98     return stream
    98     return stream
    99 
    99 
   100 
   100 
   101 class WriteAllWrapper(object):
   101 class WriteAllWrapper:
   102     def __init__(self, orig):
   102     def __init__(self, orig):
   103         self.orig = orig
   103         self.orig = orig
   104 
   104 
   105     def __getattr__(self, attr):
   105     def __getattr__(self, attr):
   106         return getattr(self.orig, attr)
   106         return getattr(self.orig, attr)
   191     if code >= 0:
   191     if code >= 0:
   192         return _(b"exited with status %d") % code
   192         return _(b"exited with status %d") % code
   193     return _(b"killed by signal %d") % -code
   193     return _(b"killed by signal %d") % -code
   194 
   194 
   195 
   195 
   196 class _pfile(object):
   196 class _pfile:
   197     """File-like wrapper for a stream opened by subprocess.Popen()"""
   197     """File-like wrapper for a stream opened by subprocess.Popen()"""
   198 
   198 
   199     def __init__(self, proc, fp):
   199     def __init__(self, proc, fp):
   200         self._proc = proc
   200         self._proc = proc
   201         self._fp = fp
   201         self._fp = fp