mirror of https://github.com/google/benchmark.git
As prevously written, "--benchmark_color=auto" was treated as true, because IsTruthyFlagValue("auto") returned true. The fix is to rely on IsColorTerminal test only if the flag value is "auto", and fall back to IsTruthyFlagValue otherwise. I also integrated force_no_color check into the same block.
This commit is contained in:
parent
9ffb8df6c5
commit
8503dfe537
|
@ -312,15 +312,20 @@ bool IsZero(double n) {
|
|||
|
||||
ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color) {
|
||||
int output_opts = ConsoleReporter::OO_Defaults;
|
||||
if ((FLAGS_benchmark_color == "auto" && IsColorTerminal()) ||
|
||||
IsTruthyFlagValue(FLAGS_benchmark_color)) {
|
||||
auto is_benchmark_color = [force_no_color] () -> bool {
|
||||
if (force_no_color) {
|
||||
return false;
|
||||
}
|
||||
if (FLAGS_benchmark_color == "auto") {
|
||||
return IsColorTerminal();
|
||||
}
|
||||
return IsTruthyFlagValue(FLAGS_benchmark_color);
|
||||
};
|
||||
if (is_benchmark_color()) {
|
||||
output_opts |= ConsoleReporter::OO_Color;
|
||||
} else {
|
||||
output_opts &= ~ConsoleReporter::OO_Color;
|
||||
}
|
||||
if (force_no_color) {
|
||||
output_opts &= ~ConsoleReporter::OO_Color;
|
||||
}
|
||||
if (FLAGS_benchmark_counters_tabular) {
|
||||
output_opts |= ConsoleReporter::OO_Tabular;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue