[Updated] D10761: run-tests: disable color in 'auto' mode on Windows if stdout is redirected
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Sun May 23 22:06:59 UTC 2021
Closed by commit rHGaf4d1a177548: run-tests: disable color in 'auto' mode on Windows if stdout is redirected (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10761?vs=28164&id=28187
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10761/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10761
AFFECTED FILES
tests/run-tests.py
CHANGE DETAILS
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2211,7 +2211,13 @@
self.faildata = {}
if options.color == 'auto':
- self.color = pygmentspresent and self.stream.isatty()
+ isatty = self.stream.isatty()
+ # For some reason, redirecting stdout on Windows disables the ANSI
+ # color processing of stderr, which is what is used to print the
+ # output. Therefore, both must be tty on Windows to enable color.
+ if os.name == 'nt':
+ isatty = isatty and sys.stdout.isatty()
+ self.color = pygmentspresent and isatty
elif options.color == 'never':
self.color = False
else: # 'always', for testing purposes
To: mharbison72, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210523/2c4debeb/attachment-0002.html>
More information about the Mercurial-patches
mailing list