mercurial/utils/procutil.py
changeset 45056 9694895749ad
parent 45045 8403cc54bc83
child 45077 fa270dcbdb55
equal deleted inserted replaced
45055:4c1b4805db57 45056:9694895749ad
    78     if isinstance(stream, LineBufferedWrapper):
    78     if isinstance(stream, LineBufferedWrapper):
    79         return stream
    79         return stream
    80     return LineBufferedWrapper(stream)
    80     return LineBufferedWrapper(stream)
    81 
    81 
    82 
    82 
    83 stderr = pycompat.stderr
    83 if pycompat.ispy3:
    84 stdin = pycompat.stdin
    84     # TODO: .buffer might not exist if std streams were replaced; we'll need
    85 stdout = pycompat.stdout
    85     # a silly wrapper to make a bytes stream backed by a unicode one.
       
    86     stdin = sys.stdin.buffer
       
    87     stdout = sys.stdout.buffer
       
    88     stderr = sys.stderr.buffer
       
    89 else:
       
    90     stdin = sys.stdin
       
    91     stdout = sys.stdout
       
    92     stderr = sys.stderr
    86 
    93 
    87 if pycompat.iswindows:
    94 if pycompat.iswindows:
    88     stdout = platform.winstdout(stdout)
    95     stdout = platform.winstdout(stdout)
    89 
    96 
    90 # glibc determines buffering on first write to stdout - if we replace a TTY
    97 # glibc determines buffering on first write to stdout - if we replace a TTY