Skip to content

Commit

Permalink
Merge pull request #23 from nmlgc/vt
Browse files Browse the repository at this point in the history
Disable VT mode if stdout is redirected
  • Loading branch information
cracyc authored Jun 20, 2024
2 parents af03f79 + 99be565 commit 8fe7085
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions msdos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3816,8 +3816,11 @@ int main(int argc, char *argv[], char *envp[])

if(use_vt) {
DWORD mode;
GetConsoleMode(hStdout, &mode);
SetConsoleMode(hStdout, mode | ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
if(GetConsoleMode(hStdout, &mode)) {
SetConsoleMode(hStdout, mode | ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
} else {
use_vt = false;
}
}

SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS);
Expand Down

0 comments on commit 8fe7085

Please sign in to comment.