From 7d2938ddcae5b908e9eefd3faec7ff585bb8d631 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 17 Jan 2019 01:30:25 +0530 Subject: [PATCH] gst-inspect: Fix ANSI escape sequence usage on Windows Either disable it when it's not supported, or setup the console to interpret them correctly when it's supported. Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/351 --- tools/gst-inspect.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 1921fe4574..7c613501f2 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -2034,6 +2034,14 @@ main (int argc, char *argv[]) } else { colored_output = FALSE; } +#elif defined(G_OS_WIN32) + { + gint fd = _fileno (stdout); + /* On Windows 10, g_log_writer_supports_color will also setup the console + * so that it correctly interprets ANSI VT sequences if it's supported */ + if (!_isatty (fd) || !g_log_writer_supports_color (fd)) + colored_output = FALSE; + } #endif gst_tools_print_version ();