[PATCH] D51611: Set console mode when -fansi-escape-codes is enabled

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 4 11:33:43 PDT 2018


xbolva00 updated this revision to Diff 163879.
xbolva00 added a comment.

- Addressed comment by @zturner


https://reviews.llvm.org/D51611

Files:
  lib/Support/Windows/Process.inc


Index: lib/Support/Windows/Process.inc
===================================================================
--- lib/Support/Windows/Process.inc
+++ lib/Support/Windows/Process.inc
@@ -328,6 +328,15 @@
 
 static bool UseANSI = false;
 void Process::UseANSIEscapeCodes(bool enable) {
+#if defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+  if (enable) {
+    HANDLE Console = GetStdHandle(STD_OUTPUT_HANDLE);
+    DWORD Mode;
+    GetConsoleMode(Console, &Mode);
+    Mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+    SetConsoleMode(Console, Mode);
+  }
+#endif
   UseANSI = enable;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51611.163879.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180904/42d0de9c/attachment.bin>


More information about the llvm-commits mailing list