Compiler diagnostics no longer colored in arduino-cli compile
output
#2308
Labels
topic: CLI
Related to the command line interface
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Uh oh!
There was an error while loading. Please reload this page.
Describe the problem
It is a common practice for command line tools to selectively color output text with the goal of enhancing the readability. This is done though ANSI escape codes.
The GCC tools used to compile Arduino sketches do such coloration of the diagnostic messages printed in their output:
https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gcc/Diagnostic-Message-Formatting-Options.html#index-GCC_005fCOLORS-environment-variable
🐛 Compiler diagnostics are not colored in the
arduino-cli compile
output.To reproduce
🙂 The diagnostics in the compiler output are colored:
🐛 The diagnostics in the compiler output are not colored:
Expected behavior
Tool output is colored in the Arduino CLI output the same as it would be if the command was invoked directly from the terminal.
Arduino CLI version
65915d8
Operating system
Linux
Operating system version
Ubuntu 22.04
Additional context
I bisected the regression to b3e8f8a (does not occur when using the build at the previous commit a735ddf).
The coloration returns if I force the compiler to add the escape codes to its output by adding the
-fdiagnostics-color
flag to the compilation commands:So it is not a matter of Arduino CLI stripping the escape codes, but rather of the context in which the compiler commands are invoked causing the compiler to not add them in its default "auto" mode:
The diagnostics are colored if I invoke the same compiler command directly from the terminal.
I don't get any coloration even when invoking the compiler command directly on my Windows machine (likely done due to a lack of support for the ANSI codes by Windows terminals).
Originally reported by @myklemykle at https://forum.arduino.cc/t/in-ardino-cli-0-33-1-compiler-errs-warnings-are-no-longer-colorized/1150508
Issue checklist
The text was updated successfully, but these errors were encountered: