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

Powershell prompt takes long time to load #1797

Closed mafriese closed 2 years ago

mafriese commented 2 years ago

Code of Conduct

What happened?

I just re-installed oh-my-posh on Windows and after it takes a really long time after each enter (at least 5 seconds) and the initial startup of the shell usually takes over 30 seconds. I tried to get any useful information from Write-PoshDebug but the only thing that took longer to execute was git - so I removed the git part from the theme (and also uninstalled git) but I still have the same issue. The only value in my powershell profile is Set-PoshPrompt -Theme amro . I tried to install it as a module, used the installer and tried the standalone binary - All methods result in the same issue. Also tried to use different console hosts - without any success.

Powershell version: 7.2.1.0 Oh-My-Posh version: 7.23.0

image

Theme

{ "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", "blocks": [ { "alignment": "left", "segments": [ { "foreground": "#45F1C2", "properties": { "template": "\uf508 {{ .UserName }} on" }, "style": "plain", "type": "session" }, { "foreground": "#0CA0D8", "properties": { "folder_separator_icon": "/", "style": "full", "template": " \uf07b {{ .Path }} " }, "style": "plain", "type": "path" } ], "type": "prompt" }, { "alignment": "left", "newline": true, "segments": [ { "foreground": "#cd5e42", "properties": { "template": "\ue3bf " }, "style": "plain", "type": "root" }, { "foreground": "#CD4277", "properties": { "template": "# " }, "style": "plain", "type": "text" } ], "type": "prompt" } ], "version": 1 }

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

# Write-PoshDebug

Version: 7.23.0

Segments:

ConsoleTitle(false) -   0 ms -
session(true)  -   0 ms -  MAFRIESE on
path(true)     -   0 ms -   ~
root(false)    -   0 ms -
text(true)     -   0 ms - #

Run duration: 1.4364ms

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

Logs:

2022/02/23 13:48:44 Args duration: 0s, args:
2022/02/23 13:48:44 Args duration: 0s, args:
2022/02/23 13:48:44 Args duration: 0s, args:
2022/02/23 13:48:44 Shell duration: 0s, args:
2022/02/23 13:48:44 debug: Getenv

2022/02/23 13:48:44 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/02/23 13:48:44 debug: Pwd
C:\Users\mafriese
2022/02/23 13:48:44 Pwd duration: 0s, args:
2022/02/23 13:48:44 debug: Home
C:\Users\mafriese
2022/02/23 13:48:44 PathSeparator duration: 0s, args:
2022/02/23 13:48:44 PathSeparator duration: 0s, args:
2022/02/23 13:48:44 debug: Pwd
C:\Users\mafriese
2022/02/23 13:48:44 Pwd duration: 0s, args:
2022/02/23 13:48:44 debug: Home
C:\Users\mafriese
2022/02/23 13:48:44 debug: Getenv

2022/02/23 13:48:44 Getenv duration: 0s, args: SSH_CONNECTION
2022/02/23 13:48:44 debug: Getenv

2022/02/23 13:48:44 Getenv duration: 0s, args: SSH_CLIENT
2022/02/23 13:48:44 Root duration: 203.4µs, args:
2022/02/23 13:48:44 Shell duration: 0s, args:
2022/02/23 13:48:44 ErrorCode duration: 0s, args:
2022/02/23 13:48:44 IsWsl duration: 0s, args:
2022/02/23 13:48:44 debug: Pwd
C:\Users\mafriese
2022/02/23 13:48:44 Pwd duration: 0s, args:
2022/02/23 13:48:44 debug: Home
C:\Users\mafriese
2022/02/23 13:48:44 PathSeparator duration: 0s, args:
2022/02/23 13:48:44 PathSeparator duration: 0s, args:
2022/02/23 13:48:44 User duration: 0s, args:
2022/02/23 13:48:44 Host duration: 0s, args:
2022/02/23 13:48:44 GOOS duration: 0s, args:
2022/02/23 13:48:44 TemplateCache duration: 203.4µs, args:
2022/02/23 13:48:44 debug: Pwd
C:\Users\mafriese
2022/02/23 13:48:44 Pwd duration: 0s, args:
2022/02/23 13:48:44 debug: Home
C:\Users\mafriese
2022/02/23 13:48:44 debug: Pwd
C:\Users\mafriese
2022/02/23 13:48:44 Pwd duration: 0s, args:
2022/02/23 13:48:44 Args duration: 0s, args:
2022/02/23 13:48:44 debug: Home
C:\Users\mafriese
2022/02/23 13:48:44 GOOS duration: 0s, args:
2022/02/23 13:48:44 GOOS duration: 0s, args:
2022/02/23 13:48:44 PathSeparator duration: 0s, args:
2022/02/23 13:48:44 GOOS duration: 0s, args:
2022/02/23 13:48:44 IsWsl duration: 0s, args:
2022/02/23 13:48:44 StackCount duration: 0s, args:
2022/02/23 13:48:44 TemplateCache duration: 0s, args:
2022/02/23 13:48:44 debug: Pwd
C:\Users\mafriese
2022/02/23 13:48:44 Pwd duration: 567.2µs, args:
2022/02/23 13:48:44 debug: Home
C:\Users\mafriese
2022/02/23 13:48:44 Root duration: 0s, args:
2022/02/23 13:48:44 debug: Pwd
C:\Users\mafriese
2022/02/23 13:48:44 Pwd duration: 0s, args:
2022/02/23 13:48:44 debug: Home
C:\Users\mafriese
2022/02/23 13:48:44 TemplateCache duration: 0s, args:
2022/02/23 13:48:44 debug: Getenv
C:\Users\mafriese\AppData\Local
2022/02/23 13:48:44 Getenv duration: 0s, args: LOCALAPPDATA
2022/02/23 13:48:44 CachePath duration: 0s, args:
JanDeDobbeleer commented 2 years ago

@mafriese whenever we noticed this, it was due to defender or a virus scanner blocking the binary execution. Adding an exclusion fixes this immediately.

mafriese commented 2 years ago

image

Can confirm that adding an exception fixes the issue - Thanks for your quick reply!

JanDeDobbeleer commented 2 years ago

@mafriese enjoy your prompt!

github-actions[bot] commented 6 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.