jazzdotdev / jazz

The Scripting Engine that Combines Speed, Safety, and Simplicity
Apache License 2.0
146 stars 11 forks source link

Disable log colors when not connected to a terminal #244

Open sineemore opened 5 years ago

sineemore commented 5 years ago

One more issue I can think off is undesired colored logs in standard output: by default logs in terminal are colored, we can toggle color support with enviroment variable NO_COLOR. But when I redirect torchbear command to a file (or a subprocess like in pipeline above) the colored logs will make it trough and reside in file.

You can test it with simple init.lua, which will raise a colored error:

yyy

Run it like this: $ torchbear init.lua > out.log && less out.log

The out.log will contain the escape sequences. I guess it is wrong behaviour.

sineemore commented 5 years ago

isatty can help.

naturallymitchell commented 5 years ago

Rust isatty() I guess