From 1201a68f662a300eacae4f908a87d4cd57f2032e Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Wed, 5 Jul 2023 22:23:31 +0200 Subject: [PATCH] Only call Win32 API to enable colored output once --- src/dscanner/analysis/run.d | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/dscanner/analysis/run.d b/src/dscanner/analysis/run.d index 18f5a0c1..99bcfd96 100644 --- a/src/dscanner/analysis/run.d +++ b/src/dscanner/analysis/run.d @@ -163,6 +163,11 @@ void enableColoredOutput() GetConsoleMode, GetStdHandle, HANDLE, INVALID_HANDLE_VALUE, SetConsoleMode, STD_OUTPUT_HANDLE; + static bool enabledColor = false; + if (enabledColor) + return; + enabledColor = true; + // Set output mode to handle virtual terminal sequences HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); if (hOut == INVALID_HANDLE_VALUE)