From ef590249ab0e74583d8d2bb95ca4af377ce62232 Mon Sep 17 00:00:00 2001 From: Scott McPeak Date: Fri, 17 May 2024 12:32:35 -0700 Subject: [PATCH] application.py: Respond to NO_COLOR environment variable (#149) Setting NO_COLOR does *not* set `plain_terminal` because that flows into `self._plain_terminal`, which is used elsewhere for things unrelated to colors. Fixes #148. --- frida_tools/application.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frida_tools/application.py b/frida_tools/application.py index b064cce9..d9413f48 100644 --- a/frida_tools/application.py +++ b/frida_tools/application.py @@ -146,7 +146,10 @@ def __init__( if hasattr(signal, "SIGPIPE"): signal.signal(signal.SIGPIPE, signal.SIG_DFL) - colorama.init(strip=True if plain_terminal else None) + # If true, emit text without colors. https://no-color.org/ + no_color = plain_terminal or bool(os.environ.get("NO_COLOR")) + + colorama.init(strip=True if no_color else None) parser = self._initialize_arguments_parser() real_args = compute_real_args(parser, args=args)