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

Setting color=True in runner.invoke on windows strips ansi codes #2705

Open
LilyFoote opened this issue Apr 11, 2024 · 0 comments
Open

Setting color=True in runner.invoke on windows strips ansi codes #2705

LilyFoote opened this issue Apr 11, 2024 · 0 comments

Comments

@LilyFoote
Copy link

I am trying to test that a click command uses colors correctly. I've set the color=True argument to runner.invoke and this keeps the ansi escape codes as expected on Linux. However, on Windows these are completely stripped, as if color=False was set.

I did see #2606 and #2607, but testing the change there isn't enough to fix this for me. I think the problem is that color=True isn't set in the Context on Windows and therefore ctx.color is still None in resolve_color_default, despite color=True being passed to invoke.

Environment:

  • Python version: 3.8 - 3.12
  • Click version: 8.1.7
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