summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAaron Klotz <aaron@tailscale.com>2026-03-04 16:16:05 -0700
committerAaron Klotz <aaron@tailscale.com>2026-03-04 16:16:05 -0700
commit10b1c372cb247189f7cc2b156b9e925f95d4da30 (patch)
tree6ad937db62f4d7f73c5ffb82857430b62ac37f34
parent30adf4527b9e55175a3391d04d6d4fbe751791d8 (diff)
downloadtailscale-aaron/gocross_ps1_redir.tar.xz
tailscale-aaron/gocross_ps1_redir.zip
Signed-off-by: Aaron Klotz <aaron@tailscale.com>
-rw-r--r--tool/gocross/gocross-wrapper.ps119
1 files changed, 11 insertions, 8 deletions
diff --git a/tool/gocross/gocross-wrapper.ps1 b/tool/gocross/gocross-wrapper.ps1
index 23bd6eb27..bdaf0ae93 100644
--- a/tool/gocross/gocross-wrapper.ps1
+++ b/tool/gocross/gocross-wrapper.ps1
@@ -204,7 +204,7 @@ Start-ChildScope -ScriptBlock $bootstrapScriptBlock
$repoRoot = Get-RepoRoot
$execEnv = Copy-Environment
-# Start-Process's -Environment arg applies diffs, so instead of removing
+# We're applying diffs to our current environment, so instead of removing
# these variables from $execEnv, we must set them to $null to indicate
# that they should be cleared.
$execEnv['GOROOT'] = $null
@@ -223,12 +223,15 @@ if ($Env:TS_USE_GOCROSS -ne '1') {
}
$procExe = Join-Path $toolchain 'bin' 'go.exe' -Resolve
- $proc = Start-Process -FilePath $procExe -WorkingDirectory $repoRoot -Environment $execEnv -ArgumentList $argList -NoNewWindow -PassThru
- $proc.WaitForExit()
- exit $proc.ExitCode
+}
+else {
+ $procExe = Join-Path $repoRoot 'gocross.exe' -Resolve
}
-$procExe = Join-Path $repoRoot 'gocross.exe' -Resolve
-$proc = Start-Process -FilePath $procExe -WorkingDirectory $repoRoot -Environment $execEnv -ArgumentList $argList -NoNewWindow -PassThru
-$proc.WaitForExit()
-exit $proc.ExitCode
+Start-ChildScope -ScriptBlock {
+ Set-Location -LiteralPath $repoRoot
+ foreach ($key in $execEnv.Keys) {
+ Set-Item -Path "Env:$key" -Value $execEnv[$key]
+ }
+ & $procExe @argList
+}