mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
testenv: improve color output a bit.
* testenv/misc/colour_terminal.py: Only print color codes when stdout isatty().
This commit is contained in:
parent
adcc793a26
commit
3a00b37bc2
@ -1,6 +1,7 @@
|
||||
from functools import partial
|
||||
import platform
|
||||
from os import getenv
|
||||
import sys
|
||||
|
||||
""" This module allows printing coloured output to the terminal when running a
|
||||
Wget Test under certain conditions.
|
||||
@ -25,11 +26,11 @@ T_COLORS = {
|
||||
'ENDC' : '\033[0m'
|
||||
}
|
||||
|
||||
system = True if platform.system() == 'Linux' else False
|
||||
system = True if platform.system() in ( 'Linux', 'Darwin' ) else False
|
||||
check = False if getenv("MAKE_CHECK") == 'True' else True
|
||||
|
||||
def printer (color, string):
|
||||
if system and check:
|
||||
if sys.stdout.isatty() and system and check:
|
||||
print (T_COLORS.get (color) + string + T_COLORS.get ('ENDC'))
|
||||
else:
|
||||
print (string)
|
||||
|
Loading…
Reference in New Issue
Block a user