Skip to content

Commit a7a7ebc

Browse files
committedSep 18, 2022
fix(shell): return correct name for shims
resolves JanDeDobbeleer#2806
1 parent c3c72b1 commit a7a7ebc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/environment/shell.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,14 @@ func (env *ShellEnvironment) Shell() string {
574574
env.Log(Error, "Shell", err.Error())
575575
return UNKNOWN
576576
}
577-
if name == "cmd.exe" {
577+
env.Log(Debug, "Shell", "process name: "+name)
578+
// this is used for when scoop creates a shim, see
579+
// https://github.com/JanDeDobbeleer/oh-my-posh/issues/2806
580+
executable, _ := os.Executable()
581+
if name == "cmd.exe" || name == executable {
578582
p, _ = p.Parent()
579583
name, err = p.Name()
584+
env.Log(Debug, "Shell", "parent process name: "+name)
580585
}
581586
if err != nil {
582587
env.Log(Error, "Shell", err.Error())

0 commit comments

Comments
 (0)
Please sign in to comment.