@@ -35,7 +35,6 @@ $PrVersion = $env:VP_PR_VERSION
3535# pulls a coherent, clearly-defined test build.
3636$BridgeDownloadBase = " https://registry-bridge.viteplus.dev/voidzero-dev/vite-plus"
3737$BridgeRegistry = " https://registry-bridge.viteplus.dev/"
38- $BootstrapNpmVersion = " 10.9.4"
3938$BootstrapPnpmVersion = " 10.33.0"
4039
4140function Write-Info {
@@ -381,6 +380,29 @@ function Resolve-BridgeCommitVersion {
381380 return " 0.0.0-commit.$sha "
382381}
383382
383+ function Invoke-BootstrapInstall {
384+ param (
385+ [string ]$VpPath ,
386+ [string ]$PnpmVersion
387+ )
388+
389+ # PowerShell surfaces native stderr as error records. Keep warnings and
390+ # pnpm diagnostics in the captured output, then rely on the process exit code.
391+ $previousErrorActionPreference = $ErrorActionPreference
392+ try {
393+ $ErrorActionPreference = " Continue"
394+ $output = cmd / c " set CI=true && `" $VpPath `" env exec --node lts cmd.exe /d /c npx --yes pnpm@$PnpmVersion install" 2>&1
395+ $exitCode = $LASTEXITCODE
396+ } finally {
397+ $ErrorActionPreference = $previousErrorActionPreference
398+ }
399+
400+ return [PSCustomObject ]@ {
401+ Output = $output
402+ ExitCode = $exitCode
403+ }
404+ }
405+
384406function Write-InstallFailure {
385407 param (
386408 [string ]$LogPath ,
@@ -884,32 +906,28 @@ function Main {
884906 $installLog = Join-Path $VersionDir " install.log"
885907 Push-Location $VersionDir
886908 try {
887- # Use cmd /c so CI=true is scoped to the child process only,
888- # avoiding leaking it into the user's shell session.
889909 # Do not pass --silent to the inner install: pnpm suppresses the
890910 # release-age error body in silent mode, which would leave
891911 # install.log empty and make the release-age gate impossible to
892912 # detect. Output is already captured to install.log here.
893- $output = cmd / c " set CI=true && `" $BinDir \vp.exe`" env exec --node lts --npm $BootstrapNpmVersion npx --yes pnpm@$BootstrapPnpmVersion install" 2>&1
894- $installExitCode = $LASTEXITCODE
895- $output | Out-File $installLog
896- if ($installExitCode -ne 0 ) {
913+ $result = Invoke-BootstrapInstall - VpPath " $BinDir \vp.exe" - PnpmVersion $BootstrapPnpmVersion
914+ $result.Output | Out-File $installLog
915+ if ($result.ExitCode -ne 0 ) {
897916 if (Test-ReleaseAgeError $installLog ) {
898917 if (Confirm-ReleaseAgeOverride ) {
899918 # Write the override only after explicit consent, then retry once.
900919 Write-ReleaseAgeOverride
901- $retryOutput = cmd / c " set CI=true && `" $BinDir \vp.exe`" env exec --node lts --npm $BootstrapNpmVersion npx --yes pnpm@$BootstrapPnpmVersion install" 2>&1
902- $retryExitCode = $LASTEXITCODE
903- $retryOutput | Out-File $installLog
904- if ($retryExitCode -ne 0 ) {
905- Write-InstallFailure - LogPath $installLog - ExitCode $retryExitCode
920+ $retryResult = Invoke-BootstrapInstall - VpPath " $BinDir \vp.exe" - PnpmVersion $BootstrapPnpmVersion
921+ $retryResult.Output | Out-File $installLog
922+ if ($retryResult.ExitCode -ne 0 ) {
923+ Write-InstallFailure - LogPath $installLog - ExitCode $retryResult.ExitCode
906924 }
907925 } else {
908926 Write-ReleaseAgeFailure $installLog
909927 Exit-Installer
910928 }
911929 } else {
912- Write-InstallFailure - LogPath $installLog - ExitCode $installExitCode
930+ Write-InstallFailure - LogPath $installLog - ExitCode $result .ExitCode
913931 }
914932 }
915933 } finally {
0 commit comments