Skip to content

Commit 1201a68

Browse files
committed
Only call Win32 API to enable colored output once
1 parent b0bb905 commit 1201a68

File tree

1 file changed

+5
-0
lines changed
  • src/dscanner/analysis

1 file changed

+5
-0
lines changed

src/dscanner/analysis/run.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ void enableColoredOutput()
163163
GetConsoleMode, GetStdHandle, HANDLE, INVALID_HANDLE_VALUE,
164164
SetConsoleMode, STD_OUTPUT_HANDLE;
165165

166+
static bool enabledColor = false;
167+
if (enabledColor)
168+
return;
169+
enabledColor = true;
170+
166171
// Set output mode to handle virtual terminal sequences
167172
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
168173
if (hOut == INVALID_HANDLE_VALUE)

0 commit comments

Comments
 (0)