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

Don't print Ansi escape sequences if NO_COLOR set or TERM=dumb #2297

Open
mbucc opened this issue Feb 20, 2023 · 2 comments
Open

Don't print Ansi escape sequences if NO_COLOR set or TERM=dumb #2297

mbucc opened this issue Feb 20, 2023 · 2 comments

Comments

@mbucc
Copy link

mbucc commented Feb 20, 2023

Quick Summary: Well-behaved Unix programs won't print Ansi escape sequences if TERM=dumb

SSCCE

% set|egrep 'NO_COLOR|TERM='
NO_COLOR=1
TERM=dumb
% elm
Hi, thank you for trying out �[92mElm�[0m �[92m0.19.1�[0m. I hope you like it!
...
  • Elm: 0.19.1
  • Browser: N/A
  • Operating System: MacOS Ventura 13.1

Additional Details

As the other poster said, export TERM=dumb is the universal way of saying that your terminal is not capable of vt100 (and other, more exotic) sequences supported by xterm and the like.
https://www.reddit.com/r/plan9/comments/iz9rdw/acme_on_linux_remove_ansi_in_win/

Command-line software which adds ANSI color to its output by default should check for a NO_COLOR environment variable that, when present and not an empty string (regardless of its value), prevents the addition of ANSI color.
https://no-color.org

@github-actions
Copy link

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions in a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

@mbucc
Copy link
Author

mbucc commented Feb 20, 2023

Workaround: elm 2>&1|perl -pe 's/\x1b\[[0-9;]*[mG]//g'

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

No branches or pull requests

1 participant