diff --git a/src/build.cc b/src/build.cc index a0557382e0..73253a0c89 100644 --- a/src/build.cc +++ b/src/build.cc @@ -298,7 +298,13 @@ void BuildStatus::PrintStatus(Edge* edge, EdgeStatus status) { to_print = FormatProgressStatus(progress_status_format_, status) + to_print; - printer_.Print(to_print, + string final_output; + if (!printer_.supports_color()) + final_output = StripAnsiEscapeCodes(to_print); + else + final_output = to_print; + + printer_.Print(final_output, force_full_command ? LinePrinter::FULL : LinePrinter::ELIDE); } diff --git a/src/line_printer.cc b/src/line_printer.cc index 55469d9837..e8be70349e 100644 --- a/src/line_printer.cc +++ b/src/line_printer.cc @@ -33,7 +33,7 @@ LinePrinter::LinePrinter() : have_blank_line_(true), console_locked_(false) { const char* term = getenv("TERM"); #ifndef _WIN32 - smart_terminal_ = isatty(1) && term && string(term) != "dumb"; + smart_terminal_ = isatty(STDOUT_FILENO) && term && string(term) != "dumb"; #else // Disable output buffer. It'd be nice to use line buffering but // MSDN says: "For some systems, [_IOLBF] provides line