File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -284,6 +284,11 @@ function Main {
284284 Write-Info " Verifying installation..."
285285 try {
286286 $versionOutput = & $destBinary version 2>&1
287+ if ($LASTEXITCODE -ne 0 ) {
288+ Write-Err " Installed binary failed its version check (exit $LASTEXITCODE ):"
289+ Write-Host $versionOutput
290+ exit 1
291+ }
287292 Write-Host $versionOutput
288293 Write-Ok " Installation complete!"
289294 } catch {
Original file line number Diff line number Diff line change @@ -284,6 +284,11 @@ function Main {
284284 Write-Info " Verifying installation..."
285285 try {
286286 $versionOutput = & $destBinary version 2>&1
287+ if ($LASTEXITCODE -ne 0 ) {
288+ Write-Err " Installed binary failed its version check (exit $LASTEXITCODE ):"
289+ Write-Host $versionOutput
290+ exit 1
291+ }
287292 Write-Host $versionOutput
288293 Write-Ok " Installation complete!"
289294 } catch {
Original file line number Diff line number Diff line change @@ -20,6 +20,24 @@ assert_equals() {
2020 [ " $expected " = " $actual " ] || fail " $description : expected $expected , got $actual "
2121}
2222
23+ assert_powershell_version_guard () {
24+ local powershell_installer=" $1 "
25+
26+ awk '
27+ /# --- Verify installation ---/ { in_verification = 1; next }
28+ /# --- Getting started ---/ { exit }
29+ !in_verification { next }
30+ /\$versionOutput = & \$destBinary version 2>&1/ { invoked = 1; next }
31+ invoked && /if \(\$LASTEXITCODE -ne 0\)/ { guarded = 1; next }
32+ guarded && /exit 1/ { exits_on_failure = 1; next }
33+ exits_on_failure && /Write-Ok "Installation complete!"/ { reports_success = 1 }
34+ END {
35+ exit !(invoked && guarded && exits_on_failure && reports_success)
36+ }
37+ ' " $powershell_installer " \
38+ || fail " PowerShell installer must fail a non-zero version check before reporting success"
39+ }
40+
2341make_platform_mocks () {
2442 local os=" $1 "
2543 local arch=" $2 "
@@ -137,6 +155,7 @@ cmp -s "$installer" "$repo_root/packages/docs-web/public/install" \
137155# PATH-corrupting installer to Windows users while the repo copy was fixed. #2339.
138156cmp -s " $repo_root /scripts/install.ps1" " $repo_root /packages/docs-web/public/install.ps1" \
139157 || fail " public install.ps1 mirror differs from scripts/install.ps1"
158+ assert_powershell_version_guard " $repo_root /scripts/install.ps1"
140159
141160mock_dir=" $tmp_dir /install-mocks"
142161install_dir=" $tmp_dir /install-bin"
You can’t perform that action at this time.
0 commit comments