ref(windows): use Sync-EnvPath to guarantee $Env:Path correctness

This commit is contained in:
AJ ONeal
2023-11-10 17:50:36 -07:00
parent 22fd0a8a0a
commit 82d8d3a6cb
7 changed files with 7 additions and 28 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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")) {

View File

@@ -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"

View File

@@ -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"

View File

@@ -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