-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
enable --ansi
by default on Windows
#3354
Comments
This is actually decided by an underlying library (clikit), and is probably due to a bug there: sdispater/clikit#35.
|
I can't reproduce your result under PowerShell 7.1.1, under the same Windows Terminal Version: I also couldn't reproduce it under git-bash
That said, I'm not totally clear from your comment... Are you testing this inside WSL? I assume so based having I'd suggest trying to get a simpler reproduction case, in terms of the applications involved in handling the output stream. Due to the recency of real PTY support in Windows, older Windows apps would often mangle ANSI codes as they passed through, and git-bash being Cygwin based has definitely been one of those in the past. |
I had a quick check, and on a different machine (with git
A quick test by piping to Confounding the above, my MSYS2 installation with runtime I'll have to check on my other machine, but now I'm wondering if there's something else system-wide which is changing the results. It's not Windows Terminal, since my home machine is running the same version you used. And one last test, it's not The only thing that comes to mind, is that by passing in these env-vars, the code that tries to activate VT processing is bypassed. I haven't checked, but perhaps when using And I therefore guess that for Cygwin-based console apps (as opposed to Powershell or CMD), VT processing is not enabled by default? Although that would imply that detection should work, since the underlying bug that blocks that is that if VT processing is already enabled, clickit returns "ANSI not supported". I'm not sure what piping through This wouldn't technically be a bug, because we're setting env-vars that claim things that aren't actually true (i.e. that we're running under ansicon, ConEmu or xterm. I'd have to do some more debugging to track this down, but I think getting sdispater/clikit#35 fixed first would be better, since it's possible that that will function correctly under Cygwin anyway, removing the need for the Edit: Recently, cleo was refactored to not depend on clikit, but the buggy code at fault in sdispater/clikit#35 was copied across. So this may now be a cleo bug to fix. Edit: Back on my home machine, it definitely doesn't reproduce under Windows Terminal, or with MSYS2 under mintty. Git bash on cmd appears to show the right ANSI codes, but the terminal is not processing them: |
I just want to say thanks for the effort, I did not have the time to look further into the issue right now, but FYI: $ git --version
git version 2.30.1.windows.1 Did not bring any relief. |
Hi @passionsfrucht @ericfrederich @TBBle. Thanks a lot for your work. I have this issue so far ->no colors at all in Arch, some colors in powershell, both started from windows terminal. Not sure about the best solution to implement at this step as I read many different bug fix on this issue... |
@johnjohnk2 I don't see Poetry in your screenshots. Are you on the correct bug-tracker? I sounds like you are looking for Windows Terminal support? |
@TBBle Hi Thanks a lot for your time. Not sure to understant as yes it is WSL2 but I came here from your 4 Jan commet where you said that the bug comes from clikit, isn' it ? |
The issue in Poetry, yes, appears to actually be a bug in clickit, a Python library used by Poetry. You appear to just be having trouble with bash (under WSL2?) and PowerShell under Windows Terminal, so no connection to Poetry or clikit. You should follow up according to the Windows Terminal support instructions, as this is the wrong place to ask. |
Ok OK sorry for my misunderstanding ! |
I could reproduce it from my Windows Terminal + git bash and poetry 1.1.6 (while it worked flawlessly with the same git bash and cmder) With poetry version 1.2.0a1, it seems all fixed (thanks to #3618 I guess):
|
I also see Poetry 1.2.0a2 failing to auto-detect ANSI support:
The (Ignore the warning about Poetry already existing, that's noticing my Poetry 1.1.7 installation) I also checked I just checked, and the faulty code that was in clickit (see sdispater/clikit#35 (comment)) is still unchanged in cleo 1.0.0a4, so the bug is still in the underlying library: Cleo only auto-detects ANSI for Windows if it can turn on I raised a new issue at python-poetry/cleo#104 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
The
--ansi
option should be default on Windows.On a fresh install of Windows 10 with a fresh install of the Windows version of Python 3.9.0
Install Poetry via:
py -m pip install --user pipx py -m pipx ensurepath # need to get a new console now for pipx to be on PATH pipx install poetry
Now in both PowerShell and in cmd.exe running
pipx --ansi
produces nice colors.Is there a reason not to default
--ansi
on Windows?The text was updated successfully, but these errors were encountered: