mercurial/utils/procutil.py
changeset 45078 fa270dcbdb55
parent 45057 9694895749ad
child 45080 8628cd1122d2
equal deleted inserted replaced
45077:23119371df5e 45078:fa270dcbdb55
   103         # On Python 2, Windows doesn't support line buffering.
   103         # On Python 2, Windows doesn't support line buffering.
   104         # Therefore we have a wrapper that implements line buffering.
   104         # Therefore we have a wrapper that implements line buffering.
   105         stdout = make_line_buffered(stdout)
   105         stdout = make_line_buffered(stdout)
   106     else:
   106     else:
   107         stdout = os.fdopen(stdout.fileno(), 'wb', 1)
   107         stdout = os.fdopen(stdout.fileno(), 'wb', 1)
   108 
       
   109 # stderr should be unbuffered
       
   110 if pycompat.ispy3:
       
   111     # On Python 3, buffered streams may expose an underlying raw stream. This is
       
   112     # definitively the case for the streams initialized by the interpreter. If
       
   113     # the attribute isn't present, the stream is already unbuffered or doesn't
       
   114     # expose an underlying raw stream, in which case we use the stream as-is.
       
   115     stderr = getattr(stderr, 'raw', stderr)
       
   116 elif pycompat.iswindows:
       
   117     # On Windows, stderr is buffered at least when connected to a pipe.
       
   118     stderr = os.fdopen(stderr.fileno(), 'wb', 0)
       
   119 # On other platforms, stderr is always unbuffered.
       
   120 
   108 
   121 
   109 
   122 findexe = platform.findexe
   110 findexe = platform.findexe
   123 _gethgcmd = platform.gethgcmd
   111 _gethgcmd = platform.gethgcmd
   124 getuser = platform.getuser
   112 getuser = platform.getuser