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

[Bug-Candidate]: --disable-color ignored, printer produces colored outputs #2229

Closed
ongrid opened this issue Nov 11, 2023 · 2 comments
Closed
Labels
bug-candidate Bugs reports that are not yet confirmed

Comments

@ongrid
Copy link

ongrid commented Nov 11, 2023

Describe the issue:

Flag --disable-color seem to be ignored and printer produces colored output with ASCII escape characters not suitable to capture into plaintext files

slither --help   
usage: slither target [flag]
Additional options:
...
  --disable-color       Disable output colorization

Workaround: pass the output through the following sed script:

slither . --print function-summary 2>&1 | sed 's/\x1b\[[0-9;]*m//g'

Code example to reproduce the issue:

image

Version:

slither --version
0.10.0

From docker image ghcr.io/trailofbits/eth-security-toolbox:nightly

Relevant log output:

No response

@ongrid ongrid added the bug-candidate Bugs reports that are not yet confirmed label Nov 11, 2023
@elopez
Copy link
Member

elopez commented Nov 11, 2023

Thanks for the report @ongrid ! It looks like this printer uses MyPrettyTable to print a table, and that class always uses a colored table. Maybe the MyPrettyTable underlying implementation should choose to use the non-colored PrettyTable class when colors are disabled: https://github.com/jazzband/prettytable#changing-the-appearance-of-your-table---with-colors

@theexoticman
Copy link

Thanks, @elopez for the pointer. I took the liberty to propose a fix. Let me know if using an environment variable follows the dev best practices guidelines. I'll add a unit test after confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Bugs reports that are not yet confirmed
Projects
None yet
Development

No branches or pull requests

4 participants