Skip to content

Commit

Permalink
Only call Win32 API to enable colored output once
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Jul 5, 2023
1 parent b0bb905 commit 1201a68
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/dscanner/analysis/run.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1201a68

Please sign in to comment.