mercurial/utils/procutil.py
changeset 45082 b6afe1c52964
parent 45081 29a905fe23ae
child 45093 63196198dbf0
equal deleted inserted replaced
45081:29a905fe23ae 45082:b6afe1c52964
    89 else:
    89 else:
    90     stdin = sys.stdin
    90     stdin = sys.stdin
    91     stdout = sys.stdout
    91     stdout = sys.stdout
    92     stderr = sys.stderr
    92     stderr = sys.stderr
    93 
    93 
    94 # glibc determines buffering on first write to stdout - if we replace a TTY
       
    95 # destined stdout with a pipe destined stdout (e.g. pager), we want line
       
    96 # buffering.
       
    97 if isatty(stdout):
    94 if isatty(stdout):
    98     if pycompat.ispy3:
    95     if pycompat.ispy3:
    99         # Python 3 implements its own I/O streams.
    96         # Python 3 implements its own I/O streams.
   100         # The standard library doesn't offer line-buffered binary streams.
    97         # The standard library doesn't offer line-buffered binary streams.
   101         stdout = make_line_buffered(stdout)
    98         stdout = make_line_buffered(stdout)
   104         stdout = platform.winstdout(stdout)
   101         stdout = platform.winstdout(stdout)
   105         # Python 2 uses the I/O streams provided by the C library.
   102         # Python 2 uses the I/O streams provided by the C library.
   106         # The Windows C runtime library doesn't support line buffering.
   103         # The Windows C runtime library doesn't support line buffering.
   107         stdout = make_line_buffered(stdout)
   104         stdout = make_line_buffered(stdout)
   108     else:
   105     else:
       
   106         # glibc determines buffering on first write to stdout - if we
       
   107         # replace a TTY destined stdout with a pipe destined stdout (e.g.
       
   108         # pager), we want line buffering.
   109         stdout = os.fdopen(stdout.fileno(), 'wb', 1)
   109         stdout = os.fdopen(stdout.fileno(), 'wb', 1)
   110 
   110 
   111 
   111 
   112 findexe = platform.findexe
   112 findexe = platform.findexe
   113 _gethgcmd = platform.gethgcmd
   113 _gethgcmd = platform.gethgcmd