Refresh Windows process PATH before duplicate check
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s

This commit is contained in:
DuProcess
2026-07-16 21:47:46 -04:00
parent 9f969b795d
commit 79495b1ba9
2 changed files with 9 additions and 3 deletions
+3 -3
View File
@@ -333,6 +333,9 @@ function Add-UserPath($PathToAdd) {
$entries = @($userPath -split ';' | Where-Object { $_ })
}
$wanted = Normalize-PathForCompare $PathToAdd
if (-not (";$env:Path;").Contains(";$PathToAdd;")) {
$env:Path = "$PathToAdd;$env:Path"
}
foreach ($entry in $entries) {
if ((Normalize-PathForCompare $entry) -ieq $wanted) {
return
@@ -344,9 +347,6 @@ function Add-UserPath($PathToAdd) {
$PathToAdd
}
[Environment]::SetEnvironmentVariable("Path", $next, "User")
if (-not (";$env:Path;").Contains(";$PathToAdd;")) {
$env:Path = "$PathToAdd;$env:Path"
}
}
function Write-Utf8NoBom($Path, $Content) {
+6
View File
@@ -239,6 +239,12 @@ fn windows_installer_adds_user_path_idempotently() {
assert!(ps1.contains("(@($entries) + $PathToAdd) -join ';'"));
assert!(ps1.contains("(\";$env:Path;\").Contains(\";$PathToAdd;\")"));
assert!(ps1.contains("$env:Path = \"$PathToAdd;$env:Path\""));
assert!(
ps1.find("(\";$env:Path;\").Contains(\";$PathToAdd;\")")
.unwrap()
< ps1.find("foreach ($entry in $entries)").unwrap(),
"Windows installer must refresh the current shell PATH even when user PATH already contains Dosh"
);
assert!(
!ps1.contains("\"$userPath;$bindir\""),
"Windows installer must not write a leading semicolon when user PATH is empty"