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
Plain text ANSI - SetConsoleMode fails on older versions of Windows 10 #55
Comments
Ooh. Interesting. Admin is a really challenging part on Windows. It works on my Windows machine, but apparently that's not true for everyone. I'll make a quick fix that ensures this no longer fails, but I'll have to spend some more time on why this fails exactly. Syscalls aren't my forte ^^ |
Is this due to me installing it as admin? |
It seems that |
Awesome, thank you! |
@kwmlodozeniec once |
I still get an exception
|
Well now. This is going the wrong way all over the place. It's actually a bug in go, as this implies it crashes underneath. We're one step further but not yet where we need to be. It seems |
@kwmlodozeniec stay tuned for |
BTW, I wasn't sure if you are still in WIP but I tried latest and I get this:
|
That's all due to being installed as admin probably causing the paths and other items to act weird. We're almost there I guess, this is related to the PowerShell module rather than the go binary so I can troubleshoot this on a Windows machine. |
I'm going to try to fix this this evening (or at least reproduce). |
@kwmlodozeniec I can't reproduce this. Can you give me the exact installation procedure you followed? |
I'm wondering if it might be connected to my fairly old build of Windows 10. It's a work machine and the IT department is very conservative about updates, hence me trying to use alacritty instead on the new windows terminal. I will try the same process on my up to date machine and see if that works fine, if that's the case I am not sure if you want to bother fixing this? It might be worth setting a minimum supported / tested version of Windows 10 in the docs. |
The error we now see if related to the Module code (PowerShell) so I'm still curious what's triggering this. Pretty sure I'm using something that's not available somewhere. Which version of PowerShell are you on? |
I've installed the latest version 7 about a week go. |
I'm going about this the wrong way. Can you open the module code and comment this line? |
Will do first thing tomorrow. |
Same thing seems to be happening with 3.14.4 (I know it has got the fix for this issue but I tried for the sake of completeness). Also, my version output:
|
I know what's happening. On Windows we need to set the output mode to interpret ANSI. That's what's failing here. I have one thing I can try, but no guarantee. |
Ok, I made a fix in the dependency which hopefully provides more result. Can you try the attached binary? |
Ok. So. What happens is this. To render ANSI on Windows the executing binary needs to tell the handler it wants to enable this. But, somehow, that functionality isn't available on your machine or the wrong handler is being used (my initial bet). Given that this is a really low level API my knowledge of the domain is limited. I'll do some more research 👍🏻 To be clear, calling the binary directly results in the same output, right? |
When calling it from PS7 standard terminal I get this:
When using alacritty
The PS7 standard terminal output is most likely due to the fact I cannot set a proper PL font on that terminal exe. |
It could be related to this alacritty/alacritty#3063 I'm going to to try alacritty myself later today. |
@kwmlodozeniec the error you see in the standard terminal is coming from here. It can't set the mode which is most likely due to your specific version of Windows. Alacritty doesn't seem to show that error, implying it can set the mode, but then doesn't interpret the ANSI characters. That's most likely an Alacritty issue. |
That's a shame. I use powerline on my home machine, where I am on the latest Win10. I guess I will have to badger IT to update my work machine to something more recent. Thanks for investigating, let me know if you find some workaround. |
TL;DR: I use a package to facilitate ANSI coloring. A while back I noticed it wouldn't render in the current consoles on Windows as it set virtual terminal processing wrong for those. HOWEVER, it might just as well be that fix breaks on other places and would also explain as to why some of the other calls were failing earlier. |
@kwmlodozeniec did you try the proposed fix in the issue above? I can't seem to run alacritty (oh noes). Unless I really need that c++ distributable. |
Yes, I already had that setting enabled, it made no difference to me. |
I might have a final thing I can try. Been reading too many docs about how to get the handle for the currently active console so stay tuned for a new version tomorrow 😉 |
@kwmlodozeniec I made a minor change locally to see if that could fix the issue. If this doesn't work I'm out of options for now. |
So, updated the executable, turned on posh in my profile.
If I then navigate to the module dir and run the exe directly I get this:
On alacritty is get the same garbage I did before. |
it just can't find the right |
To be fair this is a very specific setup with out of date windows etc. Maybe you should not waste your time on this. This works fine on my home machine with up to date windows without issues. |
Let's just say I'm intrigued as to why this doesn't work. |
@kwmlodozeniec I changed the way to executable is invoked in the prompt function. I'm curious if that would have a positive impact here as well. Can you try |
What does the |
|
Super useful. Thanks Powershell 🤦🏻♂️ |
This may be issue from ConHost. Alacritty use ConPty from Conhost. WezTerm and Windows Terminal is using ConPty from OpenConsol. I guess this issue is not happenned in WezTerm and Windows Terminal. You can see this issue on Alacritty alacritty/alacritty#4794 . |
Alacritty issue, closing this due to ago. See alacritty/alacritty#4794 for context. |
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. |
Prerequisites
[*] I have read and understand the
CONTRIBUTING
guide[*] I looked for duplicate issues before submitting this one
Description
I followed the docs and upgraded oh my posh 2 to V3 on my Win10 machine using Powershell in admin mode. When I run the terminal I get the following exception:
$PSDefaultParameterValues["Out-File:Encoding"] = "utf8"
$MaximumHistoryCount = 1000;
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme agnoster
Set-Location C:\repos
Environment
Steps to Reproduce
Expected behavior: [What you expected to happen]
Terminal starts without issues
Actual behavior: [What actually happened]
Oh my pish throws an exception
The text was updated successfully, but these errors were encountered: