Disable TTY coloring with "PLATFORMIO_DISABLE_COLOR" system environment // Resolve #2956

This commit is contained in:
Ivan Kravets committed 2019-08-29 14:34:51 +03:00
1 parent 223a85baca
commit 0440b7a2f7
3 files changed
+10 -7

No files matched your search

+7 -5
View File
@@ -55,13 +55,15 @@ def configure():
except (AttributeError, ImportError):
pass
# handle PLATFORMIO_FORCE_COLOR
if str(os.getenv("PLATFORMIO_FORCE_COLOR", "")).lower() == "true":
try:
try:
if str(os.getenv("PLATFORMIO_DISABLE_COLOR", "")).lower() == "true":
# pylint: disable=protected-access
click._compat.isatty = lambda stream: False
elif str(os.getenv("PLATFORMIO_FORCE_COLOR", "")).lower() == "true":
# pylint: disable=protected-access
click._compat.isatty = lambda stream: True
except: # pylint: disable=bare-except
pass
except: # pylint: disable=bare-except
pass
# Handle IOError issue with VSCode's Terminal (Windows)
click_echo_origin = [click.echo, click.secho]