Patchwork [04,of,11,V2] procutil: split if condition

login
register
mail settings
Submitter Manuel Jacob
Date July 12, 2020, 10:41 p.m.
Message ID <d7f793516419e60b23c5.1594593689@tmp>
Download mbox | patch
Permalink /patch/46708/
State Accepted
Headers show

Comments

Manuel Jacob - July 12, 2020, 10:41 p.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1594367976 -7200
#      Fri Jul 10 09:59:36 2020 +0200
# Node ID d7f793516419e60b23c5a667c57972a6d1ac0f0f
# Parent  ba4ec481948de77e36c8267f1acf5b904efba761
# EXP-Topic stdio
procutil: split if condition

This prepares the code for subsequent changes where we need to differentiate
between the two cases.

Patch

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -119,9 +119,11 @@ 
 # destined stdout with a pipe destined stdout (e.g. pager), we want line
 # buffering.
 if isatty(stdout):
-    if pycompat.ispy3 or pycompat.iswindows:
+    if pycompat.ispy3:
         # Python 3 implements its own I/O streams.
         # The standard library doesn't offer line-buffered binary streams.
+        stdout = make_line_buffered(stdout)
+    elif pycompat.iswindows:
         # Python 2 uses the I/O streams provided by the C library.
         # The Windows C runtime library doesn't support line buffering.
         stdout = make_line_buffered(stdout)