getsolus / solbuild

The Solus package build system
https://getsol.us
Apache License 2.0
19 stars 12 forks source link

Strip ANSI color escape sequences when not outputting to a real TTY #76

Closed ermo closed 6 months ago

ermo commented 6 months ago

Logs currently look atrocious in a web browser due to ANSI color escape sequences not being stripped when outputting to a file or piping.

It matters when reviewing build server logs in a browser and ought to be fixed once and for all.

EbonJaeger commented 6 months ago

When I output to a file and cat it, the colors appear fine in both Alacritty and gnome-terminal. How/where are you using this where it appears broken?

ermo commented 6 months ago

When I output to a file and cat it, the colors appear fine in both Alacritty and gnome-terminal. How/where are you using this where it appears broken?

solbuild logs viewed in a web browser (which is incapable of parsing ANSI terminal escape codes as colors etc.)

I suspect this was silently fixed for 1.6.0 by @silkeh though.

silkeh commented 6 months ago

This was changed in #42 (included in 1.6.0): Solbuild now only enables the colored logger if the output is a TTY.