Add support for NO_COLOR

This commit is contained in:
Martin Wickham
2021-06-21 13:47:38 -05:00
committed by Andrew Kelley
parent 7bdeda82ae
commit e2b954c273
7 changed files with 42 additions and 20 deletions

View File

@@ -16,8 +16,8 @@ enum ErrType {
};
static void print_err_msg_type(ErrorMsg *err, ErrColor color, ErrType err_type) {
bool is_tty = os_stderr_tty();
bool use_colors = color == ErrColorOn || (color == ErrColorAuto && is_tty);
bool supports_color = os_stderr_supports_color();
bool use_colors = color == ErrColorOn || (color == ErrColorAuto && supports_color);
// Show the error location, if available
if (err->path != nullptr) {