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

Always remove color codes from output file #2018

Merged
merged 1 commit into from
Feb 27, 2024
Merged

Conversation

konstin
Copy link
Member

@konstin konstin commented Feb 27, 2024

Always strip color codes when we're writing to a file.

I don't really know how to test this.

Fixes #2017

Always strip color codes when we're writing to a file.

I don't really know how to test this.

Fixes #2017
@konstin konstin added the bug Something isn't working label Feb 27, 2024
@charliermarsh
Copy link
Member

I don't understand why the autostream doesn't work here.

@konstin konstin merged commit 8214bfe into main Feb 27, 2024
7 checks passed
@konstin konstin deleted the konsti/always-strip-files branch February 27, 2024 16:02
@konstin
Copy link
Member Author

konstin commented Feb 27, 2024

It seems that we eventually call libc::isatty with the file descriptor, but i don't know why the file descriptor is suddenly a tty in jupyter.

@bluss
Copy link
Contributor

bluss commented Feb 27, 2024

It is very mysterious, but it seems like this might be the likely explanation: Something in ipython sets CLICOLOR_FORCE=1 and autostream listens to this env variable as well as a few others.

Maybe this is the culprit: https://github.com/ipython/ipykernel/blob/c1d944ece0eaeb5b1ea030f22a0e259d8fd915fd/ipykernel/zmqshell.py#L503-L504

confirmed by workaround !env -u CLICOLOR_FORCE rye sync

also related, maybe rust-cli/anstyle#178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv pip compile sometimes outputs ansi escapes in file
4 participants