Mercurial > hg
comparison tests/run-tests.py @ 47309:af4d1a177548
run-tests: disable color in 'auto' mode on Windows if stdout is redirected
Differential Revision: https://phab.mercurial-scm.org/D10761
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 06 May 2021 19:39:19 -0400 |
parents | bb4606f35d37 |
children | 9a3aa54774ff |
comparison
equal
deleted
inserted
replaced
47308:bb4606f35d37 | 47309:af4d1a177548 |
---|---|
2209 # Data stored for the benefit of generating xunit reports. | 2209 # Data stored for the benefit of generating xunit reports. |
2210 self.successes = [] | 2210 self.successes = [] |
2211 self.faildata = {} | 2211 self.faildata = {} |
2212 | 2212 |
2213 if options.color == 'auto': | 2213 if options.color == 'auto': |
2214 self.color = pygmentspresent and self.stream.isatty() | 2214 isatty = self.stream.isatty() |
2215 # For some reason, redirecting stdout on Windows disables the ANSI | |
2216 # color processing of stderr, which is what is used to print the | |
2217 # output. Therefore, both must be tty on Windows to enable color. | |
2218 if os.name == 'nt': | |
2219 isatty = isatty and sys.stdout.isatty() | |
2220 self.color = pygmentspresent and isatty | |
2215 elif options.color == 'never': | 2221 elif options.color == 'never': |
2216 self.color = False | 2222 self.color = False |
2217 else: # 'always', for testing purposes | 2223 else: # 'always', for testing purposes |
2218 self.color = pygmentspresent | 2224 self.color = pygmentspresent |
2219 | 2225 |