[PATCH] run-tests: check if stream is a tty before using color
Yuya Nishihara
yuya at tcha.org
Tue Jul 18 09:13:41 EDT 2017
On Tue, 18 Jul 2017 07:33:13 +0900, mlaneuville at gmail.com wrote:
> # HG changeset patch
> # User Matthieu Laneuville <matthieu.laneuville at octobus.net>
> # Date 1500329966 -32400
> # Tue Jul 18 07:19:26 2017 +0900
> # Node ID 7f5f97697162331b5acf78aef091ae3fd341e308
> # Parent 9b2647a7a70a270e85457ea55583b6eba0551258
> run-tests: check if stream is a tty before using color
Queued, thanks.
> @@ -1574,6 +1565,17 @@
> self.successes = []
> self.faildata = {}
>
> + global with_color
> + if not self.stream.isatty(): # check if the terminal is capable
> + with_color = False
> +
> + if options.color != 'auto':
> + if options.color == 'never':
> + with_color = False
> + else: # 'always', for testing purposes
> + if pygmentspresent:
> + with_color = True
Perhaps this no longer needs to be a global variable.
More information about the Mercurial-devel
mailing list