Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip color from ninja status #1584

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/line_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down