JanDeDobbeleer / oh-my-posh

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

`$env:POSH_GIT_ENABLED = $true` crashes oh-my-posh prompt #4595

Closed LoZeno closed 8 months ago

LoZeno commented 8 months ago

Code of Conduct

What happened?

This bug happens only on ONE machine out of three I tested, so it's probably due to some local setting on that specific machine, but I'm really in the dark trying to figure out where to look. Basically, settting $env:POSH_GIT_ENABLED = $true on powershell crashes the prompt generated by oh-my-posh, to the point that it turns into:

PS>

here's the effect: image

Whether I set the property in the powershell profile, or manually in powershell, the result does not change. It happens whether I install oh-my-posh via winget or scoop. But it happens only on ONE Dell XPS 15 laptop, while it does not happen on two other desktop PCs I have installed oh-my-posh on. The only difference I can think of between the Dell laptop and the other two machines that might matter is that on the Dell I'm not using an administrator account.

Theme

agnoster plus

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

PS>oh-my-posh debug --plain

Version: 19.4.0

Shell: oh-my-posh (7.4.0)

Prompt:

 username.redacted@LoZeno-XPS152020   

Segments:

ConsoleTitle(false)                       -   0 ms
Time(true)                                -   0 ms
Session(true)                             -   0 ms
Path(true)                                -   1 ms
Git(false)                                -  25 ms

Run duration: 37.5055ms

Cache path: C:\Users\username.redacted\AppData\Local\oh-my-posh

Config path: C:\Users\username.redacted\scoop\apps\oh-my-posh\current\themes\agnosterplus.omp.json

Logs:

[DEBUG] 13:35:43.404 shell.go:Getenv:399 → NO DATA
[TRACE] 13:35:43.404 shell.go:Getenv(TERM_PROGRAM) - 0s
[DEBUG] 13:35:43.404 shell.go:Getenv:399 → C:\Users\username.redacted\AppData\Local
[TRACE] 13:35:43.404 shell.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 13:35:43.404 shell_windows.go:CachePath() - 0s
[DEBUG] 13:35:43.404 shell.go:Getenv:399 → C:\Users\username.redacted\scoop\apps\oh-my-posh\current\themes\agnosterplus.omp.json
[TRACE] 13:35:43.404 shell.go:Getenv(POSH_THEME) - 0s
[DEBUG] 13:35:43.404 shell.go:Shell:662 → no shell name provided in flags, trying to detect it
[DEBUG] 13:35:43.414 shell.go:Shell:670 → process name: oh-my-posh.exe
[TRACE] 13:35:43.414 shell.go:Shell() - 9.6182ms
[TRACE] 13:35:43.414 shell.go:resolveConfigPath() - 9.6182ms
[TRACE] 13:35:43.414 shell.go:Init() - 10.1222ms
[TRACE] 13:35:43.414 shell.go:Flags() - 0s
[TRACE] 13:35:43.414 config.go:loadConfig() - 0s
[TRACE] 13:35:43.414 shell.go:Flags() - 0s
[DEBUG] 13:35:43.414 shell.go:Getenv:399 → NO DATA
[TRACE] 13:35:43.414 shell.go:Getenv(OMP_CACHE_DISABLED) - 0s
[TRACE] 13:35:43.414 shell_windows.go:WindowsRegistryKeyValue(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor) - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[TRACE] 13:35:43.414 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.415 shell_windows.go:WindowsRegistryKeyValue:215 → ColorizationColor(DWORD): 0xC4563A1F
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[DEBUG] 13:35:43.415 shell.go:Getenv:399 → 7.4.0
[TRACE] 13:35:43.415 shell.go:Getenv(POSH_SHELL_VERSION) - 0s
[DEBUG] 13:35:43.415 debug.go:PrintDebug:22 → Segment: Title
[DEBUG] 13:35:43.415 text.go:Render:70 → Rendering template:
[DEBUG] 13:35:43.415 shell.go:Getenv:399 → 3
[TRACE] 13:35:43.415 shell.go:Getenv(POSH_CURSOR_LINE) - 0s
[DEBUG] 13:35:43.415 shell.go:Getenv:399 → 1
[TRACE] 13:35:43.415 shell.go:Getenv(POSH_CURSOR_COLUMN) - 0s
[TRACE] 13:35:43.415 shell.go:Flags() - 0s
[TRACE] 13:35:43.415 shell.go:Flags() - 0s
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[TRACE] 13:35:43.415 shell.go:Flags() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.415 shell.go:Pwd:429 → C:\Users\username.redacted
[TRACE] 13:35:43.415 shell.go:Pwd() - 0s
[DEBUG] 13:35:43.415 shell_windows.go:56 → C:\Users\username.redacted
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.415 segment.go:SetEnabled:512 → Segment: Time
[DEBUG] 13:35:43.415 properties.go:GetString:28 → 15:04:05
[TRACE] 13:35:43.415 shell_windows.go:Root() - 0s
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[TRACE] 13:35:43.415 shell.go:StatusCodes() - 0s
[TRACE] 13:35:43.415 shell_windows.go:IsWsl() - 0s
[DEBUG] 13:35:43.415 shell.go:TemplateCache:843 → environment: [ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\username.redacted\AppData\Roaming CARGO_HOME=C:\Users\username.redacted\scoop\persist\rustup-msvc\.cargo ChocolateyInstall=C:\ProgramData\chocolatey CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=LOZENO-XPS15202 ComSpec=C:\WINDOWS\system32\cmd.exe CONDA_PROMPT_MODIFIER=False DOTNET_ROOT=C:\Users\username.redacted\scoop\apps\dotnet-sdk\current DriverData=C:\Windows\System32\Drivers\DriverData GIT_INSTALL_ROOT=C:\Users\username.redacted\scoop\apps\git-with-openssh\current HOMEDRIVE=C: HOMEPATH=\Users\username.redacted LOCALAPPDATA=C:\Users\username.redacted\AppData\Local LOGONSERVER=\\LOZENO-XPS15202 MSBuildSDKsPath=C:\Users\username.redacted\scoop\apps\dotnet-sdk\current\sdk\8.0.100\Sdks NODE_PATH=C:\Users\username.redacted\scoop\apps\yarn\current\global\node_modules NUMBER_OF_PROCESSORS=16 NVM_HOME=C:\Users\username.redacted\scoop\apps\nvm\current NVM_SYMLINK=C:\Users\username.redacted\scoop\persist\nvm\nodejs\nodejs OneDrive=C:\Users\username.redacted\OneDrive OS=Windows_NT Path=C:\Users\username.redacted\scoop\apps\pwsh\current;C:\Python310\Scripts\;C:\Python310\;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\ProgramData\chocolatey\bin;;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\Plantronics\Spokes3G\;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Docker\Docker\resources\bin;C:\Users\username.redacted\scoop\apps\gsudo\current;C:\Users\username.redacted\scoop\apps\python\current\Scripts;C:\Users\username.redacted\scoop\apps\python\current;C:\Users\username.redacted\scoop\apps\vscode\current\bin;C:\Users\username.redacted\scoop\apps\rustup-msvc\current\.cargo\bin;C:\Users\username.redacted\scoop\apps\yarn\current\global\node_modules\.bin;C:\Users\username.redacted\scoop\apps\yarn\current\bin;C:\Users\username.redacted\scoop\apps\nvm\current\nodejs\nodejs;C:\Users\username.redacted\scoop\apps\dotnet-sdk\current;C:\Users\username.redacted\scoop\apps\perl\current\perl\site\bin;C:\Users\username.redacted\scoop\apps\perl\current\perl\bin;C:\Users\username.redacted\scoop\shims;C:\Users\username.redacted\AppData\Local\Microsoft\WindowsApps;C:\Users\username.redacted\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\username.redacted\AppData\Local\Keybase\;C:\Users\username.redacted\AppData\Local\Programs\oh-my-posh\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL POSH_AZURE_ENABLED=False POSH_CURSOR_COLUMN=1 POSH_CURSOR_LINE=3 POSH_GIT_ENABLED=True POSH_INSTALLER=winget POSH_PID=7936 POSH_SHELL_VERSION=7.4.0 POSH_THEME=C:\Users\username.redacted\scoop\apps\oh-my-posh\current\themes\agnosterplus.omp.json POSH_THEMES_PATH=C:\Users\username.redacted\scoop\apps\oh-my-posh\current\themes POWERLINE_COMMAND=oh-my-posh PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 165 Stepping 2, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=a502 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PSModulePath=C:\Users\username.redacted\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\users\username.redacted\scoop\apps\pwsh\current\Modules;C:\Users\username.redacted\scoop\modules;C:\Users\username.redacted\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules PUBLIC=C:\Users\Public PYTHONIOENCODING=utf-8 RUSTUP_HOME=C:\Users\username.redacted\scoop\persist\rustup-msvc\.rustup SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\WINDOWS TEMP=C:\Users\LUCA~1.CHE\AppData\Local\Temp TMP=C:\Users\LUCA~1.CHE\AppData\Local\Temp USERDOMAIN=LOZENO-XPS15202 USERDOMAIN_ROAMINGPROFILE=LOZENO-XPS15202 USERNAME=username.redacted USERPROFILE=C:\Users\username.redacted windir=C:\WINDOWS WSLENV=WT_SESSION:WT_PROFILE_ID: WT_PROFILE_ID={574e775e-4f2a-5b96-ac1e-a2962a402336} WT_SESSION=8ceea9c1-369a-4bb3-ad82-121508d1a067 ZES_ENABLE_SYSMAN=1]
[TRACE] 13:35:43.415 shell.go:Pwd() - 0s
[DEBUG] 13:35:43.415 shell_windows.go:56 → C:\Users\username.redacted
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.415 shell.go:User:564 → username.redacted
[TRACE] 13:35:43.415 shell.go:User() - 0s
[DEBUG] 13:35:43.415 shell.go:Host:576 → LoZeno-XPS152020
[TRACE] 13:35:43.415 shell.go:Host() - 0s
[TRACE] 13:35:43.415 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.415 shell.go:Getenv:399 → NO DATA
[TRACE] 13:35:43.415 shell.go:Getenv(SHLVL) - 0s
[TRACE] 13:35:43.415 shell.go:TemplateCache() - 0s
[DEBUG] 13:35:43.415 text.go:Render:70 → Rendering template:  {{ .CurrentDate | date .Format }}
[TRACE] 13:35:43.415 shell.go:TemplateCache() - 0s
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[DEBUG] 13:35:43.415 text.go:Render:70 → Rendering template: plain
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[TRACE] 13:35:43.415 shell.go:Shell() - 0s
[TRACE] 13:35:43.415 shell.go:Flags() - 0s
[TRACE] 13:35:43.416 shell.go:Pwd() - 0s
[DEBUG] 13:35:43.416 shell_windows.go:56 → C:\Users\username.redacted
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.416 segment.go:SetEnabled:512 → Segment: Git
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:Flags() - 0s
[TRACE] 13:35:43.416 shell.go:Pwd() - 0s
[DEBUG] 13:35:43.416 shell_windows.go:56 → C:\Users\username.redacted
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.416 segment.go:SetEnabled:512 → Segment: Session
[DEBUG] 13:35:43.416 shell.go:Getenv:399 → NO DATA
[TRACE] 13:35:43.416 shell.go:Getenv(SSH_CONNECTION) - 0s
[DEBUG] 13:35:43.416 shell.go:Getenv:399 → NO DATA
[TRACE] 13:35:43.416 shell.go:Getenv(SSH_CLIENT) - 0s
[TRACE] 13:35:43.416 shell.go:TemplateCache() - 0s
[TRACE] 13:35:43.416 shell.go:Flags() - 0s
[TRACE] 13:35:43.416 shell.go:Pwd() - 0s
[DEBUG] 13:35:43.416 shell_windows.go:56 → C:\Users\username.redacted
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.416 segment.go:SetEnabled:512 → Segment: Path
[TRACE] 13:35:43.416 shell.go:Pwd() - 0s
[TRACE] 13:35:43.416 shell.go:Shell() - 0s
[TRACE] 13:35:43.416 shell.go:Shell() - 0s
[DEBUG] 13:35:43.416 properties.go:GetBool:22 → mapped_locations_enabled: true
[DEBUG] 13:35:43.416 properties.go:GetString:28 → 
[DEBUG] 13:35:43.416 properties.go:GetString:28 → 
[DEBUG] 13:35:43.416 shell_windows.go:56 → C:\Users\username.redacted
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[DEBUG] 13:35:43.416 properties.go:GetString:28 → 
[DEBUG] 13:35:43.416 properties.go:GetKeyValueMap:46 → mapped_locations: map[]
[TRACE] 13:35:43.416 shell.go:PathSeparator() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:PathSeparator() - 0s
[TRACE] 13:35:43.416 shell.go:PathSeparator() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:PathSeparator() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:PathSeparator() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:GOOS() - 0s
[TRACE] 13:35:43.416 shell.go:PathSeparator() - 0s
[TRACE] 13:35:43.416 shell.go:Pwd() - 0s
[TRACE] 13:35:43.416 shell_windows.go:IsWsl() - 0s
[TRACE] 13:35:43.416 shell.go:StackCount() - 0s
[DEBUG] 13:35:43.417 win32_windows.go:isWriteable:299 → not current user or in group
[DEBUG] 13:35:43.417 win32_windows.go:isWriteable:299 → not current user or in group
[DEBUG] 13:35:43.417 win32_windows.go:isWriteable:303 → current user is member of S-1-5-21-1003285355-2297299672-459102443-1005
[DEBUG] 13:35:43.417 win32_windows.go:isWriteable:311 ↓
    WRITE_DAC
    WRITE_OWNER
    SYNCHRONIZE
    DELETE
    READ_CONTROL
[DEBUG] 13:35:43.417 win32_windows.go:isWriteable:313 → user has write access
[TRACE] 13:35:43.417 shell_windows.go:DirIsWritable() - 1.0149ms
[TRACE] 13:35:43.417 shell.go:TemplateCache() - 0s
[DEBUG] 13:35:43.440 shell.go:CommandPath:615 → C:\Users\username.redacted\scoop\shims\git.exe
[TRACE] 13:35:43.440 shell.go:CommandPath(git.exe) - 24.3477ms
[TRACE] 13:35:43.440 shell.go:HasCommand(git.exe) - 24.3477ms
[TRACE] 13:35:43.440 shell.go:Pwd() - 0s
[ERROR] 13:35:43.441 shell.go:HasParentFilePath:758 → CreateFile .git: The system cannot find the file specified.
[TRACE] 13:35:43.441 shell.go:HasParentFilePath(.git) - 517µs
[DEBUG] 13:35:43.441 properties.go:GetBool:22 → fetch_bare_info: false
[DEBUG] 13:35:43.441 text.go:Render:70 → Rendering template:  {{ .UserName }}@{{ .HostName }}
[DEBUG] 13:35:43.441 text.go:Render:70 → Rendering template:  {{ .Path }}
[TRACE] 13:35:43.441 shell.go:TemplateCache() - 0s
[TRACE] 13:35:43.441 shell.go:TemplateCache() - 0s
[TRACE] 13:35:43.441 shell.go:Shell() - 0s
[TRACE] 13:35:43.441 shell.go:Shell() - 0s
[DEBUG] 13:35:43.441 text.go:Render:70 → Rendering template: powerline
[DEBUG] 13:35:43.441 text.go:Render:70 → Rendering template: powerline
[DEBUG] 13:35:43.441 text.go:Render:70 → Rendering template: powerline
[TRACE] 13:35:43.441 shell.go:Shell() - 0s
[TRACE] 13:35:43.441 shell.go:Shell() - 0s
[TRACE] 13:35:43.441 shell.go:Shell() - 0s
[TRACE] 13:35:43.441 shell.go:Shell() - 0s
[DEBUG] 13:35:43.441 shell.go:Getenv:399 → C:\Users\username.redacted\AppData\Local
[TRACE] 13:35:43.441 shell.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 13:35:43.441 shell_windows.go:CachePath() - 0s
[TRACE] 13:35:43.441 shell.go:Flags() - 0s
JanDeDobbeleer commented 8 months ago

@LoZeno you probably don't have posh-git installed or imported. We use the switch as asking PowerShell if the module is available is very time consuming.

LoZeno commented 8 months ago

@JanDeDobbeleer posh-git is installed via scoop, and is also added to $PROFILE

JanDeDobbeleer commented 8 months ago

@LoZeno you can check what $error says in this case. But that's 99,9% the issue