File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -887,11 +887,12 @@ int main(int argc, char ** argv) {
887887 sigaction (SIGINT, &sigint_action, NULL );
888888#elif defined (_WIN32)
889889 signal (SIGINT, sigint_handler);
890- // Windows console ANSI color fix
891- HANDLE hConsole = GetStdHandle (STD_OUTPUT_HANDLE);
892- DWORD mode;
893- GetConsoleMode (hConsole, &mode);
894- SetConsoleMode (hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
890+
891+ // Windows console ANSI color fix
892+ DWORD mode;
893+ HANDLE hConsole = GetStdHandle (STD_OUTPUT_HANDLE);
894+ if (hConsole && hConsole != INVALID_HANDLE_VALUE && GetConsoleMode (hConsole, &mode))
895+ SetConsoleMode (hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
895896#endif
896897
897898 fprintf (stderr, " %s: interactive mode on.\n " , __func__);
You can’t perform that action at this time.
0 commit comments