[llvm] [llvm] Do not use Console API if the output isn't a console device (PR #90230)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 13:15:40 PDT 2024


mstorsjo wrote:

So, I'm not very well acquainted with these APIs, so I'll try to summarize my understanding of the situation:

- If we're outputting directly to a terminal, we set colors using the console APIs - this works since a long time
- If we're invoked via ninja, the output is buffered, the output isn't a terminal, and we currently don't output any colors. But this patch changes that.
- This patch makes us output ANSI codes instead of using console APIs for color. This has traditionally not worked with older versions of windows terminal, but is supported by recent versions. This is also supported by virtually all unix-like terminals.

I'm not entirely following @alvinhochun's comment here - I presume this is about when we're outputting directly to a terminal, whether we should prefer ANSI codes or console APIs for setting color? And that it's possible to query this with `ENABLE_VIRTUAL_TERMINAL_PROCESSING`?

All in all, this sounds mostly reasonable to me, but I'll see if @aganea or @tru or @zmodem have anything to say.

https://github.com/llvm/llvm-project/pull/90230


More information about the llvm-commits mailing list