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

load(io.popen('oh-my-posh init cmd'):read("*a")) returns nil #4712

Closed BeatsuDev closed 6 months ago

BeatsuDev commented 6 months ago

Code of Conduct

What happened?

I'm trying to setup oh-my-posh for cmd with clink. This is the oh-my-posh.lua:

load(io.popen('oh-my-posh init cmd'):read("*a"))()

When I open CMD I get:

Microsoft Windows [Version 10.0.19045.4046]
(c) Microsoft Corporation. All rights reserved.
Loaded aliases.

Clink v1.6.4.1dd7ec
Copyright (c) 2012-2018 Martin Ridgers
Portions Copyright (c) 2020-2023 Christopher Antos
https://github.com/chrisant996/clink

C:\Users\ericb\AppData\Local\clink\oh-my-posh.lua:1: attempt to call a nil value
C:\Users\ericb>

Windows version 10.0.19045 (x64) Clink version 1.6.4.1dd7ec (x64)

Theme

None

What OS are you seeing the problem on?

Windows

Which shell are you using?

cmd

Log output

Version: 19.11.4

Shell: cmd

Prompt:

 ericb   ~   

Segments:

ConsoleTitle(true)                        -   1 ms
Session(true)                             -   0 ms
Path(true)                                -   1 ms
Git(false)                                -   8 ms
Root(false)                               -   0 ms
Status(true)                              -   0 ms
Node(false)                               -   0 ms
Go(false)                                 -   0 ms
Python(false)                             -   0 ms
Shell(false)                              -   0 ms
Time(false)                               -   0 ms

Run duration: 14.8746ms

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

Config path: no --config set, using default built-in configuration

Logs:

[DEBUG] 17:54:56.395 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.395 shell.go:Getenv(TERM_PROGRAM) - 0s
[DEBUG] 17:54:56.395 shell.go:Getenv:398 → C:\Users\ericb\AppData\Local
[TRACE] 17:54:56.395 shell.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 17:54:56.395 shell_windows.go:CachePath() - 0s
[DEBUG] 17:54:56.396 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.396 shell.go:Getenv(POSH_THEME) - 0s
[DEBUG] 17:54:56.396 shell.go:resolveConfigPath:318 → No config set, fallback to default config
[TRACE] 17:54:56.396 shell.go:resolveConfigPath() - 0s
[TRACE] 17:54:56.396 shell.go:Init() - 516.7µs
[TRACE] 17:54:56.396 shell.go:Flags() - 0s
[DEBUG] 17:54:56.396 config.go:loadConfig:129 → no config file specified, using default
[TRACE] 17:54:56.396 config.go:loadConfig() - 0s
[TRACE] 17:54:56.396 shell.go:Flags() - 0s
[DEBUG] 17:54:56.396 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.396 shell.go:Getenv(OMP_CACHE_DISABLED) - 0s
[TRACE] 17:54:56.396 shell_windows.go:WindowsRegistryKeyValue(HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor) - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[TRACE] 17:54:56.396 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.396 shell_windows.go:WindowsRegistryKeyValue:217 → ColorizationColor(DWORD): 0xC4FFB900
[DEBUG] 17:54:56.396 shell.go:Shell:663 → no shell name provided in flags, trying to detect it
[DEBUG] 17:54:56.401 shell.go:Shell:671 → process name: cmd.exe
[TRACE] 17:54:56.401 shell.go:Shell() - 5.1756ms
[DEBUG] 17:54:56.401 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.401 shell.go:Getenv(POSH_SHELL_VERSION) - 0s
[DEBUG] 17:54:56.401 debug.go:PrintDebug:22 → Segment: Title
[DEBUG] 17:54:56.401 text.go:Render:70 → Rendering template: {{ .Shell }} in {{ .Folder }}
[TRACE] 17:54:56.401 shell_windows.go:Root() - 0s
[TRACE] 17:54:56.401 shell.go:Shell() - 0s
[TRACE] 17:54:56.401 shell.go:StatusCodes() - 0s
[TRACE] 17:54:56.401 shell_windows.go:IsWsl() - 0s
[DEBUG] 17:54:56.401 shell.go:TemplateCache:844 → environment: [=::=::\ =C:=C:\Users\ericb =clink.bin=C:\Program Files (x86)\clink =clink.id=5192 =clink.profile=C:\Users\ericb\AppData\Local\clink =clink.scripts= =ExitCode=00000000 ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\ericb\AppData\Roaming ChocolateyInstall=C:\ProgramData\chocolatey ChocolateyLastPathUpdate=133503162958053249 ChocolateyToolsLocation=C:\tools CLINK_DIR=C:\Program Files (x86)\clink clink_dummy_capture_env=  COLUMNS=120 CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=DESKTOP-8C2TUKR ComSpec=C:\Windows\system32\cmd.exe DriverData=C:\Windows\System32\Drivers\DriverData HOMEDRIVE=C: HOMEPATH=\Users\ericb LINES=30 LOCALAPPDATA=C:\Users\ericb\AppData\Local LOGONSERVER=\\DESKTOP-8C2TUKR NUMBER_OF_PROCESSORS=4 NVM_HOME=C:\Users\ericb\AppData\Roaming\nvm NVM_SYMLINK=C:\Program Files\nodejs OneDrive=C:\Users\ericb\OneDrive - NTNU OneDriveCommercial=C:\Users\ericb\OneDrive - NTNU OS=Windows_NT Path=C:\Program Files\Zulu\zulu-21\bin\;C:\Program Files\Eclipse Adoptium\jdk-17.0.8.7-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\cygwin64\bin;C:\Program Files\PuTTY\;%NVM_HOME%;%NVM_SYMLINK%;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.6\bin;;C:\Program Files\Docker\Docker\resources\bin;C:\Users\ericb\.cargo\bin;C:\Users\ericb\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\ericb\AppData\Local\Programs\Python\Python311\;C:\Users\ericb\scoop\shims;C:\Users\ericb\AppData\Local\Microsoft\WindowsApps;C:\Users\ericb\AppData\Local\Programs\Microsoft VS Code\bin;C:\tools\mysql\current\bin;C:\Users\ericb\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Users\ericb\AppData\Local\Microsoft\WinGet\Packages\PyPy.PyPy.3.9_Microsoft.Winget.Source_8wekyb3d8bbwe\pypy3.9-v7.3.11-win64;C:\Users\ericb\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\ericb\.pyenv\pyenv-win\bin;C:\Users\ericb\.pyenv\pyenv-win\shims;C:\Program Files (x86)\Nmap;C:\Users\ericb\AppData\Local\Microsoft\WinGet\Packages\cURL.cURL_Microsoft.Winget.Source_8wekyb3d8bbwe\curl-8.4.0_6-win64-mingw\bin;C:\Program Files\Neovim\bin;C:\Users\ericb\AppData\Local\Microsoft\WinGet\Packages\Hugo.Hugo.Extended_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\ericb\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\ericb\AppData\Local\Microsoft\WinGet\Packages\pnpm.pnpm_Microsoft.Winget.Source_8wekyb3d8bbwe;;C:\Users\ericb\AppData\Local\Programs\oh-my-posh\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC POSH_INSTALLER=winget POSH_THEMES_PATH=C:\Users\ericb\AppData\Local\Programs\oh-my-posh\themes PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 94 Stepping 3, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=5e03 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PROMPT=$P$G PSModulePath=C:\Users\ericb\Documents\WindowsPowerShell\Modules;C:\Users\ericb\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell PUBLIC=C:\Users\Public PYENV=%USERPROFILE%\.pyenv\pyenv-win\ SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\ericb\AppData\Local\Temp TMP=C:\Users\ericb\AppData\Local\Temp USERDOMAIN=DESKTOP-8C2TUKR USERDOMAIN_ROAMINGPROFILE=DESKTOP-8C2TUKR USERNAME=ericb USERPROFILE=C:\Users\ericb windir=C:\Windows]
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.401 shell.go:Pwd:428 → C:\Users\ericb
[TRACE] 17:54:56.401 shell.go:Pwd() - 0s
[DEBUG] 17:54:56.401 shell_windows.go:58 → C:\Users\ericb
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[TRACE] 17:54:56.401 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.401 shell.go:User:563 → ericb
[TRACE] 17:54:56.402 shell.go:User() - 504.2µs
[DEBUG] 17:54:56.402 shell.go:Host:575 → DESKTOP-8C2TUKR
[TRACE] 17:54:56.402 shell.go:Host() - 15.4µs
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.402 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.402 shell.go:Getenv(SHLVL) - 0s
[TRACE] 17:54:56.402 shell.go:TemplateCache() - 519.6µs
[DEBUG] 17:54:56.402 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.402 shell.go:Getenv(POSH_CURSOR_LINE) - 0s
[DEBUG] 17:54:56.402 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.402 shell.go:Getenv(POSH_CURSOR_COLUMN) - 0s
[TRACE] 17:54:56.402 shell.go:Flags() - 0s
[TRACE] 17:54:56.402 shell.go:Flags() - 0s
[TRACE] 17:54:56.402 shell.go:Shell() - 0s
[TRACE] 17:54:56.402 shell.go:Shell() - 0s
[TRACE] 17:54:56.402 shell.go:Flags() - 0s
[TRACE] 17:54:56.402 shell.go:Flags() - 0s
[TRACE] 17:54:56.402 shell.go:Pwd() - 0s
[DEBUG] 17:54:56.402 properties.go:GetString:28 → {{ .Code }}
[TRACE] 17:54:56.402 shell.go:Pwd() - 0s
[DEBUG] 17:54:56.402 shell_windows.go:58 → C:\Users\ericb
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.402 shell_windows.go:58 → C:\Users\ericb
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.402 segment.go:SetEnabled:518 → Segment: Status
[TRACE] 17:54:56.402 shell.go:StatusCodes() - 0s
[DEBUG] 17:54:56.402 text.go:Render:70 → Rendering template: {{ .Code }}
[DEBUG] 17:54:56.402 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.402 shell.go:Flags() - 0s
[TRACE] 17:54:56.402 shell.go:Getenv(SSH_CONNECTION) - 0s
[TRACE] 17:54:56.402 shell.go:Flags() - 0s
[DEBUG] 17:54:56.402 shell.go:Getenv:398 → NO DATA
[TRACE] 17:54:56.402 shell.go:Getenv(SSH_CLIENT) - 0s
[TRACE] 17:54:56.402 shell.go:TemplateCache() - 0s
[TRACE] 17:54:56.402 shell.go:Flags() - 0s
[TRACE] 17:54:56.402 shell.go:Pwd() - 0s
[DEBUG] 17:54:56.402 shell_windows.go:58 → C:\Users\ericb
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.402 segment.go:SetEnabled:518 → Segment: Root
[TRACE] 17:54:56.402 shell.go:Pwd() - 0s
[TRACE] 17:54:56.402 shell.go:Pwd() - 0s
[DEBUG] 17:54:56.402 shell_windows.go:58 → C:\Users\ericb
[DEBUG] 17:54:56.402 shell_windows.go:58 → C:\Users\ericb
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.402 segment.go:SetEnabled:518 → Segment: Git
[DEBUG] 17:54:56.402 segment.go:SetEnabled:518 → Segment: Path
[TRACE] 17:54:56.402 shell_windows.go:Root() - 0s
[TRACE] 17:54:56.402 shell.go:Pwd() - 0s
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[TRACE] 17:54:56.402 shell.go:Shell() - 0s
[DEBUG] 17:54:56.402 shell.go:Getenv:398 → C:\Users\ericb\AppData\Local
[TRACE] 17:54:56.402 shell.go:Getenv(LOCALAPPDATA) - 0s
[DEBUG] 17:54:56.402 properties.go:GetBool:22 → mapped_locations_enabled: true
[DEBUG] 17:54:56.402 properties.go:GetString:28 → 
[DEBUG] 17:54:56.402 properties.go:GetString:28 → 
[DEBUG] 17:54:56.402 shell_windows.go:58 → C:\Users\ericb
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[DEBUG] 17:54:56.402 properties.go:GetString:28 → ~
[DEBUG] 17:54:56.402 properties.go:GetKeyValueMap:46 → mapped_locations: map[]
[TRACE] 17:54:56.402 shell.go:PathSeparator() - 0s
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[TRACE] 17:54:56.402 shell.go:GOOS() - 0s
[TRACE] 17:54:56.402 shell.go:TemplateCache() - 0s
[DEBUG] 17:54:56.402 properties.go:GetBool:22 → always_enabled: true
[TRACE] 17:54:56.402 shell.go:TemplateCache() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:PathSeparator() - 0s
[TRACE] 17:54:56.403 shell.go:PathSeparator() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:PathSeparator() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:PathSeparator() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:GOOS() - 0s
[TRACE] 17:54:56.403 shell.go:PathSeparator() - 0s
[TRACE] 17:54:56.403 shell.go:Pwd() - 0s
[TRACE] 17:54:56.403 shell_windows.go:IsWsl() - 0s
[TRACE] 17:54:56.403 shell.go:StackCount() - 0s
[DEBUG] 17:54:56.404 win32_windows.go:isWriteable:299 → not current user or in group
[DEBUG] 17:54:56.404 win32_windows.go:isWriteable:303 → current user is member of S-1-5-32-544
[DEBUG] 17:54:56.404 win32_windows.go:isWriteable:311 ↓
    WRITE_DAC
    WRITE_OWNER
    SYNCHRONIZE
    DELETE
    READ_CONTROL
[DEBUG] 17:54:56.404 win32_windows.go:isWriteable:313 → user has write access
[TRACE] 17:54:56.404 shell_windows.go:DirIsWritable() - 532.7µs
[TRACE] 17:54:56.404 shell.go:TemplateCache() - 0s
[DEBUG] 17:54:56.409 shell.go:CommandPath:615 → C:\Program Files\Git\cmd\git.exe
[TRACE] 17:54:56.409 shell.go:CommandPath(git.exe) - 7.1481ms
[TRACE] 17:54:56.409 shell.go:HasCommand(git.exe) - 7.1481ms
[TRACE] 17:54:56.409 shell.go:Pwd() - 0s
[ERROR] 17:54:56.409 shell.go:HasParentFilePath:759 → CreateFile .git: The system cannot find the file specified.
[TRACE] 17:54:56.410 shell.go:HasParentFilePath(.git) - 1.0013ms
[DEBUG] 17:54:56.410 properties.go:GetBool:22 → fetch_bare_info: false
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template:  {{ if .SSHSession }} {{ end }}{{ .UserName }}
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template:  {{ if gt .Code 0 }}{{ else }}{{ end }}
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template:   {{ path .Path .Location }}
[TRACE] 17:54:56.410 shell.go:TemplateCache() - 0s
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[TRACE] 17:54:56.410 shell.go:TemplateCache() - 0s
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[TRACE] 17:54:56.410 shell.go:TemplateCache() - 0s
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template: diamond
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template: powerline
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template: powerline
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template: powerline
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template: {{ if gt .Code 0 }}p:red{{ end }}
[TRACE] 17:54:56.410 shell.go:TemplateCache() - 0s
[DEBUG] 17:54:56.410 text.go:Render:70 → Rendering template: diamond
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[TRACE] 17:54:56.410 shell.go:Flags() - 0s
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[TRACE] 17:54:56.410 shell.go:Shell() - 0s
[DEBUG] 17:54:56.410 shell.go:Getenv:398 → C:\Users\ericb\AppData\Local
[TRACE] 17:54:56.410 shell.go:Getenv(LOCALAPPDATA) - 0s
[TRACE] 17:54:56.410 shell_windows.go:CachePath() - 0s
[TRACE] 17:54:56.410 shell.go:Flags() - 0s
JanDeDobbeleer commented 6 months ago

@BeatsuDev this is highly likely a configuration issue on your device as I can't reproduce this with the exact same setup (except Windows 10.0.22000.0).

image