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

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

View File

@ -9,8 +9,9 @@ PlatformIO 4.0
4.0.3 (2019-??-??) 4.0.3 (2019-??-??)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
* Update SCons tool to 3.1.1 * Support `PLATFORMIO_DISABLE_COLOR <http://docs.platformio.org/en/latest/envvars.html#envvar-PLATFORMIO_DISABLE_COLOR>`__ system environment variable which disables color ANSI-codes in a terminal output (`issue #2956 <https://github.com/platformio/platformio-core/issues/2956>`_)
* Generate ``.ccls`` LSP file for `Vim <http://docs.platformio.org/en/page/vim.html>`__ cross references, hierarchies, completion and semantic highlighting (`issue #2952 <https://github.com/platformio/platformio-core/issues/2952>`_) * Generate ``.ccls`` LSP file for `Vim <http://docs.platformio.org/en/page/vim.html>`__ cross references, hierarchies, completion and semantic highlighting (`issue #2952 <https://github.com/platformio/platformio-core/issues/2952>`_)
* Updated SCons tool to 3.1.1
* Remove ProjectConfig cache when "platformio.ini" was modified outside * Remove ProjectConfig cache when "platformio.ini" was modified outside
* Fixed an issue with PIO Unified Debugger on Windows OS when debug server is piped * Fixed an issue with PIO Unified Debugger on Windows OS when debug server is piped
* Fixed an issue when `--upload-port <http://docs.platformio.org/page/userguide/cmd_run.html#cmdoption-platformio-run-upload-port>`__ CLI flag does not override declared `upload_port <http://docs.platformio.org/page/projectconf/section_env_upload.html#upload-port>`__ option in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__ * Fixed an issue when `--upload-port <http://docs.platformio.org/page/userguide/cmd_run.html#cmdoption-platformio-run-upload-port>`__ CLI flag does not override declared `upload_port <http://docs.platformio.org/page/projectconf/section_env_upload.html#upload-port>`__ option in `"platformio.ini" (Project Configuration File) <https://docs.platformio.org/page/projectconf.html>`__

2
docs

Submodule docs updated: 6fd93411b2...771f77b155

View File

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