Allow to force to output color ANSI-codes even if the output is a `pipe (not a tty`)

This commit is contained in:
Ivan Kravets committed 2016-01-19 21:03:49 +02:00
1 parent 3035d4eeec
commit cc1dec39cf
4 files changed
+18 -2

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
import sys
VERSION = (2, 7, "2.dev4")
VERSION = (2, 7, "2.dev5")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"
+9 -1
View File
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from os import listdir
from os import getenv, listdir
from os.path import join
from platform import system
from sys import exit as sys_exit
@@ -94,6 +94,14 @@ def main():
"Invalid installation of Python `requests` package`. See "
"< https://github.com/platformio/platformio/issues/252 >")
# handle PLATFORMIO_FORCE_COLOR
if str(getenv("PLATFORMIO_FORCE_COLOR", "")).lower() == "true":
try:
# pylint: disable=protected-access
click._compat.isatty = lambda stream: True
except: # pylint: disable=bare-except
pass
cli(None, None, None)
except Exception as e: # pylint: disable=W0703
if not isinstance(e, exception.ReturnErrorCode):