[llvm-bugs] [Bug 38817] New: -fansi-escape-codes should set Windows console mode

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 3 10:54:34 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38817

            Bug ID: 38817
           Summary: -fansi-escape-codes should set Windows console mode
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kpreisert at gmail.com
                CC: llvm-bugs at lists.llvm.org

The Windows console in recent versions actually supports ANSI escape codes, see
https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences.
For some reason, this does not yet work correctly with Clang. I tried setting
-fansi-escape-codes, but then I see the ANSI sequences themselves printed,
instead of the colors that the ANSI sequences should produce:

clang-cl.exe: ←[0;1;31merror: ←[0mno input files←[0m

Probably the console mode is not set correctly, so the
ENABLE_VIRTUAL_TERMINAL_PROCESSING flag should be set with SetConsoleMode.

You might also want to have a look into
https://blogs.msdn.microsoft.com/commandline/2018/08/02/windows-command-line-introducing-the-windows-pseudo-console-conpty/
and optionally use the new API if available, but that's another topic.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180903/57b7f1dd/attachment.html>


More information about the llvm-bugs mailing list