fix(pwsh): never output BOM for init scripts

This commit is contained in:
Jan De Dobbeleer
2026-02-22 15:30:49 +01:00
committed by Jan De Dobbeleer
parent fefd73a7b5
commit 4a2d9958f1
3 changed files with 8 additions and 1 deletions
+4
View File
@@ -25,5 +25,9 @@
"editor.codeActionsOnSave": {
"source.fixAll.markdownlint": "explicit"
}
},
"files.encoding": "utf8",
"[powershell]": {
"files.encoding": "utf8"
}
}
+3
View File
@@ -196,6 +196,9 @@ func generateScript(env runtime.Environment, feats Features) string {
return fmt.Sprintf("echo \"No initialization script available for %s\"", env.Flags().Shell)
}
// Remove UTF-8 BOM if present, as it can cause issues in some shells.
script = strings.TrimPrefix(script, "\xef\xbb\xbf")
init := strings.NewReplacer(
"::OMP::", executable,
"::SESSION_ID::", cache.SessionID(),
+1 -1
View File
@@ -1,4 +1,4 @@
# remove any existing dynamic module of OMP
# remove any existing dynamic module of OMP
if ($null -ne (Get-Module -Name "oh-my-posh-core")) {
Remove-Module -Name "oh-my-posh-core" -Force
}