Giter Club home page Giter Club logo

Comments (43)

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024 1

@kwmlodozeniec stay tuned for 3.14.1

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024 1

I've installed the latest version 7 about a week go.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024 1

Will do first thing tomorrow.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024 1

image

Get-
InstalledModule -Name oh-my-posh

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
3.14.3-beta          oh-my-posh                          PSGallery            A prompt them…

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:

C:\repos> $PSVersionTable

Name                           Value                        PSGallery            A prompt the
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.10240
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024 1

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.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024 1

Yes, I already had that setting enabled, it made no difference to me.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024 1

Let's just say I'm intrigued as to why this doesn't work.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024 1

Without enabled a theme, just import the module I get this
image

If I enable a theme, for example Set-PoshPrompt -Theme paradox I get this:
image

So no error but it also stop posh-git from loading and prompt is just PS>

from oh-my-posh.

levirs565 avatar levirs565 commented on May 11, 2024 1

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 .

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

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 ^^

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

Is this due to me installing it as admin?

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

It seems that user.Current() fails in that case which is a standard golang call to retrieve the current user information. It also doesn't have an error option so I'll catch it and return an empty string in that case. I'm writing a solution as I type this. Stay tuned.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

Awesome, thank you!
What's interesting though is that in this case I am not running PS as admin explicitly, I only run as admin for installation.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

@kwmlodozeniec once 3.14.0 is available, can you validate that fixes the issue?

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024
C:\repos> Get-InstalledModule -Name oh-my-posh

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
3.14.0-beta          oh-my-posh                          PSGallery            A prompt theme engine for any shell

I still get an exception

Exception 0xc0000005 0x0 0x7ffe29500fff 0x46af8e0000
PC=0x46af8e0000

syscall.loadsystemlibrary(0xc00000d100, 0xc00000e8c0, 0xc00000e8c0, 0x20)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/runtime/syscall_windows.go:136 +0xe7
syscall.LoadDLL(0x13c1ee5, 0xb, 0xc000024000, 0xc00001a000, 0xc0000756a0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:81 +0x16a
syscall.(*LazyDLL).Load(0xc0000041e0, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:245 +0xc8
syscall.(*LazyProc).Find(0xc000043bf0, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:300 +0xbf
syscall.(*LazyProc).mustFind(...)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:318
syscall.(*LazyProc).Addr(...)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/dll_windows.go:327
syscall.GetUserProfileDirectory(0x1ec, 0xc0000a4680, 0xc000075780, 0xc0000a4680, 0x46af7b9460)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/zsyscall_windows.go:1910 +0x3e
syscall.Token.GetUserProfileDirectory(0x1ec, 0xc00000b290, 0x2c, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/syscall/security_windows.go:368 +0x8f
os/user.current(0x0, 0x0, 0x0)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/os/user/lookup_windows.go:217 +0x1c7
os/user.Current.func1()
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/os/user/lookup.go:15 +0x29
sync.(*Once).doSlow(0x14d7de0, 0x13cf080)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/sync/once.go:66 +0xf7
sync.(*Once).Do(...)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/sync/once.go:57
os/user.Current(0xc000075a08, 0x1307e52, 0x30000)
        C:/hostedtoolcache/windows/go/1.15.2/x64/src/os/user/lookup.go:15 +0x105
main.(*environment).homeDir(0xc000004760, 0x0, 0xc000075b80)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/environment.go:68 +0x2d
main.(*path).inHomeDir(...)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment_path.go:89
main.(*path).rootLocation(0xc000005d80, 0xc00000ccc0, 0x10, 0xc000005d80, 0xc000005d60)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment_path.go:97 +0x85
main.(*path).getAgnosterPath(0xc000005d80, 0x0, 0x0)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment_path.go:77 +0xac
main.(*path).string(0xc000005d80, 0x13f7901, 0xc000004760)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment_path.go:41 +0x212
main.(*Segment).string(...)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/segment.go:72
main.(*engine).renderBlockSegments(0xc000075f40, 0xc0000401e0, 0x0, 0x0)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/engine.go:97 +0x1c3
main.(*engine).render(0xc000075f40)
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/engine.go:126 +0xf6
main.main()
        D:/a/oh-my-posh3/oh-my-posh3/src/github.com/JanDeDobbeleer/oh-my-posh3/main.go:64 +0x3f5
rax     0x7ffe253672d4
rbx     0xffffffffffbadd11
rcx     0x41
rdi     0x46af712d00
rsi     0x7ffe253672d4
rbp     0x0
rsp     0x46af53f4d0
r8      0x0
r9      0x8ac
r10     0x0
r11     0x46af7b93f0
r12     0x7ffe29330000
r13     0x7ffe253610e8
r14     0xc000007a
r15     0x7ffe25365c70
rip     0x46af8e0000
rflags  0x10206
cs      0x33
fs      0x53
gs      0x2b

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

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 usr, err := user.Current() is also used for the home directory. Given that go crashes rather than return a value in the err variable, I'll need to replace that as well.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

BTW, I wasn't sure if you are still in WIP but I tried latest and I get this:

 Set-PoshPrompt -Theme agnoster
The parameter is incorrect.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

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.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

I'm going to try to fix this this evening (or at least reproduce).

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

@kwmlodozeniec I can't reproduce this. Can you give me the exact installation procedure you followed?
image

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

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.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

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?

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

I'm going about this the wrong way. Can you open the module code and comment this line?

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

Ok, I made a fix in the dependency which hopefully provides more result. Can you try the attached binary?

posh.zip

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

image
Looks like the same result. I have tried it with and without the line you have asked me to comment out earlier.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

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?

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

When calling it from PS7 standard terminal I get this:

.\posh-windows-amd64.exe
64 The parameter is incorrect.
�[38;2;255;255;255;49m�[7m�[m�[0m�[48;2;255;255;255m�[38;2;16;14;35m �[0m�[48;2;255;255;255m�[38;2;16;14;35mmlodozk�[0m�[48;2;255;255;255m�[38;2;16;14;35m@�[0m�[48;2;255;255;255m�[38;2;16;14;35mPORTISHEAD�[0m�[48;2;255;255;255m�[38;2;16;14;35m �[0m�[48;2;145;221;255m�[38;2;255;255;255m�[0m�[48;2;145;221;255m�[38;2;16;14;35m ~\..\..\..\..\..\bin �[0m�[38;2;145;221;255m�[0m

When using alacritty

.\posh-windows-amd64.exe

?[38;2;255;255;255;49m?[7m?[m?[0m?[48;2;255;255;255m?[38;2;16;14;35m ?[0m?[48;2;255;255;255m
?[38;2;16;14;35mmlodozk?[0m?[48;2;255;255;255m?[38;2;16;14;35m@?[0m?[48;2;255;255;255m?[38;2;
16;14;35mPORTISHEAD?[0m?[48;2;255;255;255m?[38;2;16;14;35m ?[0m?[48;2;145;221;255m?[38;2;255;
255;255m?[0m?[48;2;145;221;255m?[38;2;16;14;35m ~\..\..\..\..\..\bin ?[0m?[38;2;145;221;255m
?[0m

The PS7 standard terminal output is most likely due to the fact I cannot set a proper PL font on that terminal exe.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

It could be related to this alacritty/alacritty#3063

I'm going to to try alacritty myself later today.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

@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.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

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.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

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.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

@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.
afbeelding

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

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 😉

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

@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.
posh2.zip

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

So, updated the executable, turned on posh in my profile.
On PS7 terminal I get this when starting:

92 The handle is invalid.

If I then navigate to the module dir and run the exe directly I get this:

64 The parameter is incorrect.
�[38;2;255;255;255;49m�[7m�[m�[0m�[48;2;255;255;255m�[38;2;16;14;35m �[0m�[48;2;255;255;255m�[38;2;16;14;35mmlodozk�[0m�[48;2;255;255;255m�[38;2;16;14;35m@�[0m�[48;2;255;255;255m�[38;2;16;14;35mPORTISHEAD�[0m�[48;2;255;255;255m�[38;2;16;14;35m �[0m�[48;2;145;221;255m�[38;2;255;255;255m�[0m�[48;2;145;221;255m�[38;2;16;14;35m ~\..\..\..\..\..\bin �[0m�[38;2;145;221;255m�[0m�[0m

On alacritty is get the same garbage I did before.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

it just can't find the right stdout. I have no idea how to proceed with this one now.

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024

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.

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

@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 3.23.0?

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

What does the $error variable hold?

from oh-my-posh.

kwmlodozeniec avatar kwmlodozeniec commented on May 11, 2024
PS>Get-Variable error

Name                           Value
----                           -----
Error                          {}

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

Super useful. Thanks Powershell 🤦🏻‍♂️

from oh-my-posh.

JanDeDobbeleer avatar JanDeDobbeleer commented on May 11, 2024

Alacritty issue, closing this due to ago. See alacritty/alacritty#4794 for context.

from oh-my-posh.

github-actions avatar github-actions commented on May 11, 2024

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.
If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.

from oh-my-posh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.