Allow colored output when using `make --output-sync`

Using `make -jN simulator-tests` wasn't producing colored output because it was
not detecting the output as a terminal correctly.  This change restores the
terminal coloring when running the simulator.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1159/head
Michael Richters 3 years ago
parent ea291858b2
commit bccfad592c
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -3240,6 +3240,10 @@ bool ShouldUseColor(bool stdout_is_tty) {
// console there does support colors. // console there does support colors.
return stdout_is_tty; return stdout_is_tty;
#else #else
// In case we're running from `make --output-sync`, we need to check
// MAKE_TERMOUT to determine if the output is going to a terminal.
const char* const make_termout = posix::GetEnv("MAKE_TERMOUT");
if (make_termout != nullptr) stdout_is_tty = true;
// On non-Windows platforms, we rely on the TERM variable. // On non-Windows platforms, we rely on the TERM variable.
const char* const term = posix::GetEnv("TERM"); const char* const term = posix::GetEnv("TERM");
const bool term_supports_color = const bool term_supports_color =

Loading…
Cancel
Save