Skip to content

Commit 5231f34

Browse files
authored
Merge f5009d7 into 9ffb8df
2 parents 9ffb8df + f5009d7 commit 5231f34

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/benchmark.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,20 @@ bool IsZero(double n) {
312312

313313
ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color) {
314314
int output_opts = ConsoleReporter::OO_Defaults;
315-
if ((FLAGS_benchmark_color == "auto" && IsColorTerminal()) ||
316-
IsTruthyFlagValue(FLAGS_benchmark_color)) {
315+
auto is_benchmark_color = [force_no_color] () -> bool {
316+
if (force_no_color) {
317+
return false;
318+
}
319+
if (FLAGS_benchmark_color == "auto") {
320+
return IsColorTerminal();
321+
}
322+
return IsTruthyFlagValue(FLAGS_benchmark_color);
323+
};
324+
if (is_benchmark_color()) {
317325
output_opts |= ConsoleReporter::OO_Color;
318326
} else {
319327
output_opts &= ~ConsoleReporter::OO_Color;
320328
}
321-
if (force_no_color) {
322-
output_opts &= ~ConsoleReporter::OO_Color;
323-
}
324329
if (FLAGS_benchmark_counters_tabular) {
325330
output_opts |= ConsoleReporter::OO_Tabular;
326331
} else {

0 commit comments

Comments
 (0)