From 6fa4ff56385831f01bd9d993178969a4eddbcdbf Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 7 Apr 2022 13:53:05 +0200 Subject: tests: py: Don't colorize output if stderr is redirected Cover for calls with '2>/tmp/log' and avoid printing escape sequences to that file. One could still keep colored output on stdout, but that required a printing routine for non-errors. Signed-off-by: Phil Sutter --- tests/py/nft-test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index 04dac8d7..b66a33c2 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -39,7 +39,7 @@ signal_received = 0 class Colors: - if sys.stdout.isatty(): + if sys.stdout.isatty() and sys.stderr.isatty(): HEADER = '\033[95m' GREEN = '\033[92m' YELLOW = '\033[93m' -- cgit v1.2.3