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

ANSI color codes are printed when not a tty #1095

Closed
stevenengler opened this issue Apr 10, 2023 · 2 comments
Closed

ANSI color codes are printed when not a tty #1095

stevenengler opened this issue Apr 10, 2023 · 2 comments

Comments

@stevenengler
Copy link

When the output of miniserve is written to a file or pipe, the ANSI color codes are still printed and the output looks like:

ESC[1mminiserveESC[0m v0.23.0
Bound to ESC[1;32m[::]:8080ESC[0m, ESC[1;32m0.0.0.0:8080ESC[0m
Serving path ESC[1;33m/fooESC[0m
Available at (non-exhaustive list):
    ESC[1;32mhttp://127.0.0.1:8080ESC[0m
    ESC[1;32mhttp://[::1]:8080ESC[0m

Most applications check if it's running in a tty and only show color codes when it is, and sometimes allow that behaviour to be overridden. For example cargo has CARGO_TERM_COLOR and --color. It would be nice if miniserve did so as well.

@svenstaro
Copy link
Owner

This should be fixed now, please check whether that works for you.

@stevenengler
Copy link
Author

Works for me, thanks!

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

2 participants