From 784bc5566db03310c766d13f9727d2fa106cd570 Mon Sep 17 00:00:00 2001 From: Phaedrus Leeds Date: Sun, 20 Feb 2022 17:35:49 -0600 Subject: [PATCH] Disable fancy output when G_MESSAGES_DEBUG is set Just as we already call flatpak_disable_fancy_output() in flatpak_option_context_parse() in case verbose output is enabled via CLI options, disable fancy output in case verbose output was enabled via the G_MESSAGES_DEBUG env var. Without this change, the result of doing e.g. $ G_MESSAGES_DEBUG=OSTree flatpak install ... is pretty useless and ugly, when the output isn't being redirected to a file, since the debug messages are overwritten when we redraw to show progress updates. This makes the output of "flatpak list" a bit ugly when G_MESSAGES_DEBUG is set, but it seems like a small price to pay. --- common/flatpak-utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index d5e79f9a..aa0778db 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -721,6 +721,9 @@ flatpak_fancy_output (void) if (g_strcmp0 (g_getenv ("FLATPAK_FANCY_OUTPUT"), "0") == 0) return FALSE; + if (getenv ("G_MESSAGES_DEBUG")) + return FALSE; + return isatty (STDOUT_FILENO); }