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

--benchmark_color=auto (the default value) always prints color #559

Closed
guoyr opened this issue Mar 24, 2018 · 1 comment · Fixed by #699
Closed

--benchmark_color=auto (the default value) always prints color #559

guoyr opened this issue Mar 24, 2018 · 1 comment · Fixed by #699
Assignees

Comments

@guoyr
Copy link
Contributor

guoyr commented Mar 24, 2018

Benchmark defaults to "auto" for deciding to whether to use color or not, as part of the following conditional:

  if ((FLAGS_benchmark_color == "auto" && IsColorTerminal()) ||
      IsTruthyFlagValue(FLAGS_benchmark_color)) {
    // print color.
}

But IsTruthyFlagValue is permissive and returns true for the string "auto", causing IsColorTerminal() to be ignored.

@dmah42 dmah42 self-assigned this Mar 26, 2018
@dmah42
Copy link
Member

dmah42 commented Mar 26, 2018

PR in progress.

iillyyaa added a commit to iillyyaa/benchmark that referenced this issue Oct 5, 2018
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.
iillyyaa added a commit to iillyyaa/benchmark that referenced this issue Oct 5, 2018
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.
dmah42 pushed a commit that referenced this issue Oct 8, 2018
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.
JBakamovic pushed a commit to JBakamovic/benchmark that referenced this issue Dec 6, 2018
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants