Currently, the type of terminal ($TERM) is checked in s_terminal_has_color() to decide if colors are supported. However, the stderr can be redirected to a file or another process which doesn't support colors. To check if stderr is being received by a terminal, at least the isatty() POSIX function must be called.
More advanced checks like ttyname() could be used.
Currently, the type of terminal (
$TERM
) is checked ins_terminal_has_color()
to decide if colors are supported. However, thestderr
can be redirected to a file or another process which doesn't support colors. To check ifstderr
is being received by a terminal, at least theisatty()
POSIX function must be called.More advanced checks like
ttyname()
could be used.