JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.37k stars 2.38k forks source link

No more oh-my-posh prompt rendering at all with 8.3.2 on Windows 22621.1 #2399

Closed MeikTranel closed 2 years ago

MeikTranel commented 2 years ago

Code of Conduct

What happened?

Oh-my-posh fails to render any theme even after reinstalling everything. Not even the default theme.

I uninstalled everything with winget, removed the old powershell module, deleted everything posh related on my machine.

Debug even shows that it tries to render everything correctly.

image image

This might be something related to Windows Insider Beta Channel 22621.1 but i'm not sure (anyways thats the build currently going out to seekers on non-insider machines so we're gonna have to deal with it).

The issue seems to be unrelated to shell app itself since it happens in Terminal, VSCode etc.

It feels like its clearing all console output just after everything was printed to the shell.

Theme

Default/Ys/Agnoster/Custom

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

PS>oh-my-posh debug          

Version: 8.3.2

Segments:

ConsoleTitle(false) -   0 ms - 
python(false)  -   0 ms - 
text(true)     -   0 ms - # 
root(false)    -   0 ms - 
session(true)  -   0 ms - mtr @ MTR-NB 
path(true)     -   0 ms - in ~ 
git(false)     -  23 ms - 
time(true)     -   0 ms - [11:13:04]
exit(false)    -   0 ms - 
text(true)     -   0 ms - $

Run duration: 61.474ms

Cache path: C:\Users\mtr\AppData\Local\oh-my-posh

Config path: C:\Users\mtr\AppData\Local\Programs\oh-my-posh\themes\ys.omp.json

Logs:

2022/06/09 11:13:04 debug: Getenv
C:\Users\mtr\AppData\Local
2022/06/09 11:13:04 Getenv duration: 0s, args: LOCALAPPDATA
2022/06/09 11:13:04 CachePath duration: 99.1µs, args: 
2022/06/09 11:13:04 debug: Getenv
C:\Users\mtr\AppData\Local\Programs\oh-my-posh\themes\ys.omp.json
2022/06/09 11:13:04 Getenv duration: 0s, args: POSH_THEME
2022/06/09 11:13:04 Shell duration: 35.3412ms, args:
2022/06/09 11:13:04 resolveConfigPath duration: 35.3412ms, args:
2022/06/09 11:13:04 Init duration: 35.4403ms, args:
2022/06/09 11:13:04 Flags duration: 0s, args:
2022/06/09 11:13:04 config.loadConfig duration: 595.8µs, args:
2022/06/09 11:13:04 Flags duration: 0s, args:
2022/06/09 11:13:04 debug: Getenv

2022/06/09 11:13:04 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/06/09 11:13:04 WindowsRegistryKeyValue duration: 0s, args: HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 debug: WindowsRegistryKeyValue
ColorizationColor(DWORD): 0xC40078D4
2022/06/09 11:13:04 Root duration: 0s, args:
2022/06/09 11:13:04 Shell duration: 0s, args:
2022/06/09 11:13:04 ErrorCode duration: 0s, args:
2022/06/09 11:13:04 IsWsl duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 debug: User
mtr
2022/06/09 11:13:04 User duration: 0s, args:
2022/06/09 11:13:04 debug: Host
MTR-NB
2022/06/09 11:13:04 Host duration: 526.7µs, args:
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 526.7µs, args:
2022/06/09 11:13:04 Flags duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 debug: Getenv

2022/06/09 11:13:04 Getenv duration: 0s, args: VIRTUAL_ENV
2022/06/09 11:13:04 debug: Getenv

2022/06/09 11:13:04 Getenv duration: 0s, args: CONDA_ENV_PATH
2022/06/09 11:13:04 debug: Getenv

2022/06/09 11:13:04 Getenv duration: 0s, args: CONDA_DEFAULT_ENV
2022/06/09 11:13:04 Flags duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 Shell duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 Root duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 debug: Getenv

2022/06/09 11:13:04 Getenv duration: 0s, args: SSH_CONNECTION
2022/06/09 11:13:04 debug: Getenv

2022/06/09 11:13:04 Getenv duration: 0s, args: SSH_CLIENT
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 Shell duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 Flags duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 PathSeparator duration: 0s, args:
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 IsWsl duration: 0s, args:
2022/06/09 11:13:04 StackCount duration: 0s, args:
2022/06/09 11:13:04 DirIsWritable duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 Shell duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 HasCommand duration: 23.2878ms, args: git.exe
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/06/09 11:13:04 HasParentFilePath duration: 59.4µs, args: .git
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 Shell duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 ErrorCode duration: 0s, args:
2022/06/09 11:13:04 ErrorCode duration: 0s, args:
2022/06/09 11:13:04 Flags duration: 0s, args:
2022/06/09 11:13:04 debug: Pwd
C:\Users\mtr
2022/06/09 11:13:04 Pwd duration: 0s, args:
2022/06/09 11:13:04 debug: Home
C:\Users\mtr
2022/06/09 11:13:04 GOOS duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 TemplateCache duration: 0s, args:
2022/06/09 11:13:04 Shell duration: 0s, args:
2022/06/09 11:13:04 debug: Getenv
C:\Users\mtr\AppData\Local
2022/06/09 11:13:04 Getenv duration: 0s, args: LOCALAPPDATA
2022/06/09 11:13:04 CachePath duration: 0s, args:
2022/06/09 11:13:04 Flags duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@MeikTranel what does $error say?

MeikTranel commented 2 years ago

Got it to work again - i think this is an issue already reported - at least i saw it somewhere: image

The term 'Get-GitStatus' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
Get-GitStatus : The term 'Get-GitStatus' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:94 char:33
+             $global:GitStatus = Get-GitStatus
+                                 ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-GitStatus:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

My profile still said $env:POSH_GIT_ENABLED = $true - git seems to be integrated in oh-my-posh without the poshgit integration now right? I did a restart and removed that line and fixed it. But maybe it should actually write out the error somewhere instead failing silently.

JanDeDobbeleer commented 2 years ago

@MeikTranel unfortunately that's how PowerShell works 😅

MeikTranel commented 2 years ago

True i know the struggle - my only question is how it is that i set POSH_GIT_ENABLED to $false, it then fixes the prompt but git status display still works: image Does Oh-my-posh support poshgit but falls back to it's own implementation once POSH_GIT_ENABLED is $false?

If so wouldn't be possible to check if Get-Command Get-GitStatus is available before using it so oh-my-posh has opportunity to print an error or skip the element?

JanDeDobbeleer commented 2 years ago

@MeikTranel we did that in the past but the validation is timely and it slows down everything. Adding that check on $true is also error prone as there's no guarantee that's not forced to $true afterwards.

github-actions[bot] commented 9 months ago

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.