From 82d8d3a6cb2c7a91afdb103999c8783f0bd338ac Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 10 Nov 2023 17:50:36 -0700 Subject: [PATCH] ref(windows): use Sync-EnvPath to guarantee $Env:Path correctness --- go-essentials/install.ps1 | 3 +-- go/install.ps1 | 3 +-- golang/install.ps1 | 3 +-- tinygo/install.ps1 | 7 +------ vim-commentary/install.ps1 | 6 +----- vim-zig/install.ps1 | 6 +----- xcaddy/install.ps1 | 7 +------ 7 files changed, 7 insertions(+), 28 deletions(-) diff --git a/go-essentials/install.ps1 b/go-essentials/install.ps1 index 2e70e68..aac742b 100644 --- a/go-essentials/install.ps1 +++ b/go-essentials/install.ps1 @@ -2,8 +2,7 @@ if (!(Get-Command "go.exe" -ErrorAction SilentlyContinue)) { & "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" go - # because we need git.exe to be available to golang immediately - $Env:PATH = "$Env:USERPROFILE\go\bin;$Env:USERPROFILE\.local\opt\go\bin;$Env:PATH" + $null = Sync-EnvPath } # Special to go: re-run all go tooling builds diff --git a/go/install.ps1 b/go/install.ps1 index d759c7b..e271608 100644 --- a/go/install.ps1 +++ b/go/install.ps1 @@ -12,8 +12,7 @@ $pkg_dst_bin = "$pkg_dst\bin" if (!(Get-Command "git.exe" -ErrorAction SilentlyContinue)) { & "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" git - # because we need git.exe to be available to golang immediately - $Env:PATH = "$Env:USERPROFILE\.local\opt\git\cmd;$Env:PATH" + $null = Sync-EnvPath } # Fetch archive diff --git a/golang/install.ps1 b/golang/install.ps1 index d759c7b..e271608 100644 --- a/golang/install.ps1 +++ b/golang/install.ps1 @@ -12,8 +12,7 @@ $pkg_dst_bin = "$pkg_dst\bin" if (!(Get-Command "git.exe" -ErrorAction SilentlyContinue)) { & "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" git - # because we need git.exe to be available to golang immediately - $Env:PATH = "$Env:USERPROFILE\.local\opt\git\cmd;$Env:PATH" + $null = Sync-EnvPath } # Fetch archive diff --git a/tinygo/install.ps1 b/tinygo/install.ps1 index b6dbc81..1cb8d2d 100644 --- a/tinygo/install.ps1 +++ b/tinygo/install.ps1 @@ -30,12 +30,7 @@ IF (!(Test-Path -Path "$pkg_download")) { Write-Output "Checking for Go compiler..." IF (-Not (Get-Command -Name "go" -ErrorAction Silent)) { & "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" go - $Env:Path = "$HOME\.local\opt\go\bin;$Env:Path" - $Env:Path = "$HOME\go\bin;$Env:Path" - [System.Environment]::SetEnvironmentVariable( - "Path", - $env:Path, - [System.EnvironmentVariableTarget]::User) + $null = Sync-EnvPath } IF (!(Test-Path -Path "$pkg_src")) { diff --git a/vim-commentary/install.ps1 b/vim-commentary/install.ps1 index 4bcec12..5a0f654 100644 --- a/vim-commentary/install.ps1 +++ b/vim-commentary/install.ps1 @@ -39,11 +39,7 @@ function fn_git_shallow_clone { Write-Output "Checking for Git..." IF (-Not (Get-Command -Name "git" -ErrorAction Silent)) { & "$HOME\.local\bin\webi-pwsh.ps1" git - $Env:Path = "$HOME\.local\opt\git\cmd;$Env:Path" - [System.Environment]::SetEnvironmentVariable( - "Path", - $env:Path, - [System.EnvironmentVariableTarget]::User) + $null = Sync-EnvPath } Write-Output "Cloning $Env:PKG_NAME from $Env:WEBI_PKG_URL to $pkg_src" diff --git a/vim-zig/install.ps1 b/vim-zig/install.ps1 index 70e6db7..408cc71 100644 --- a/vim-zig/install.ps1 +++ b/vim-zig/install.ps1 @@ -39,11 +39,7 @@ function fn_git_shallow_clone { Write-Output "Checking for Git..." IF (-Not (Get-Command -Name "git" -ErrorAction Silent)) { & "$HOME\.local\bin\webi-pwsh.ps1" git - $Env:Path = "$HOME\.local\opt\git\cmd;$Env:Path" - [System.Environment]::SetEnvironmentVariable( - "Path", - $env:Path, - [System.EnvironmentVariableTarget]::User) + $null = Sync-EnvPath } Write-Output "Cloning $Env:PKG_NAME from $Env:WEBI_PKG_URL to $pkg_src" diff --git a/xcaddy/install.ps1 b/xcaddy/install.ps1 index b48aaf7..22a3775 100644 --- a/xcaddy/install.ps1 +++ b/xcaddy/install.ps1 @@ -23,12 +23,7 @@ $pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" Write-Output "Checking for Go compiler..." IF (-Not (Get-Command -Name "go" -ErrorAction Silent)) { & "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" go - $Env:Path = "$HOME\.local\opt\go\bin;$Env:Path" - $Env:Path = "$HOME\go\bin;$Env:Path" - [System.Environment]::SetEnvironmentVariable( - "Path", - $env:Path, - [System.EnvironmentVariableTarget]::User) + $null = Sync-EnvPath } # Fetch archive