Skip to content

Commit b37e095

Browse files
authored
Do not call SetConsoleMode if the mode is already set
1 parent 0fed2ab commit b37e095

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ int main(int argc, char ** argv) {
944944
// Enable ANSI colors on Windows 10+
945945
unsigned long dwMode = 0;
946946
void* hConOut = GetStdHandle((unsigned long)-11); // STD_OUTPUT_HANDLE (-11)
947-
if (hConOut && hConOut != (void*)-1 && GetConsoleMode(hConOut, &dwMode))
947+
if (hConOut && hConOut != (void*)-1 && GetConsoleMode(hConOut, &dwMode) && !(dwMode & 0x4))
948948
SetConsoleMode(hConOut, dwMode | 0x4); // ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x4)
949949
#endif
950950
printf(ANSI_COLOR_YELLOW);

0 commit comments

Comments
 (0)