From 19b42c21c765aa3f1a95ed68cdb6c0c1057fcf4c Mon Sep 17 00:00:00 2001 From: boyska Date: Sun, 12 Jan 2020 02:44:10 +0100 Subject: [PATCH] disable colors on pipe --- rscli/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rscli/cli.py b/rscli/cli.py index efa9bcf..d3b5892 100644 --- a/rscli/cli.py +++ b/rscli/cli.py @@ -9,8 +9,11 @@ from rscli.httputils import req try: from colors import color + has_colors = True except ImportError: + has_colors = False +if not has_colors or not sys.stdout.isatty(): def color(text, *args, **kwargs): return text