[fix] do not colorize output on dumb terminals

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2020-12-30 15:24:29 +01:00 committed by Alexandre Flament
parent ca0889d488
commit 9c581466e1

View file

@ -1,11 +1,12 @@
import sys import sys
import os
import searx.search import searx.search
import searx.search.processors import searx.search.processors
import searx.search.checker import searx.search.checker
if sys.stdout.isatty(): if sys.stdout.isatty() and os.environ.get('TERM') not in ['dumb', 'unknown']:
RESET_SEQ = "\033[0m" RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm" COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m" BOLD_SEQ = "\033[1m"