This allows this use case:
BABELTRACE_FORCE_COLORS=1 babeltrace ... |& less -R
to see the logging's color in `less`.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
static bool supports_colors = false;
static bool supports_colors_set = false;
const char *term;
+ const char *force;
if (supports_colors_set) {
goto end;
supports_colors_set = true;
+ force = getenv("BABELTRACE_FORCE_COLORS");
+ if (force && strcmp(force, "1") == 0) {
+ supports_colors = true;
+ goto end;
+ }
+
term = getenv("TERM");
if (!term) {
goto end;