Skip to content

Commit

Permalink
Disable TTY coloring with "PLATFORMIO_DISABLE_COLOR" system environme…
Browse files Browse the repository at this point in the history
…nt // Resolve #2956
  • Loading branch information
ivankravets committed Aug 29, 2019
1 parent 223a85b commit 0440b7a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion HISTORY.rst
Expand Up @@ -9,8 +9,9 @@ PlatformIO 4.0
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>`_)
* Updated SCons tool to 3.1.1
* 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 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>`__
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 1 files
+5 −0 envvars.rst
12 changes: 7 additions & 5 deletions platformio/__main__.py
Expand Up @@ -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]
Expand Down

0 comments on commit 0440b7a

Please sign in to comment.