Skip to content

Commit fd40497

Browse files
committed
Remove unreliable LASTEXITCODE checks from Scoop commands
Scoop commands leave $LASTEXITCODE in unpredictable states even on success. With $ErrorActionPreference = "Stop", real errors will be caught automatically. The separate bash verification step confirms installation succeeded.
1 parent d4e84b4 commit fd40497

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

setup/install-quarto-windows.ps1

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,11 @@ try {
3434

3535
$version=$args[0]
3636
scoop bucket add r-bucket https://github.com/cderv/r-bucket.git
37-
if ($LASTEXITCODE -ne 0) {
38-
Write-Error "Failed to add r-bucket with exit code $LASTEXITCODE"
39-
exit 1
40-
}
4137

4238
if ([string]::IsNullOrEmpty($version)) {
4339
scoop install quarto
44-
if ($LASTEXITCODE -ne 0) {
45-
Write-Error "Failed to install quarto with exit code $LASTEXITCODE"
46-
exit 1
47-
}
4840
} elseif ($version -eq 'pre-release') {
49-
Invoke-Expression -Command "scoop install quarto-prerelease"
50-
if ($LASTEXITCODE -ne 0) {
51-
Write-Error "Failed to install quarto-prerelease with exit code $LASTEXITCODE"
52-
exit 1
53-
}
41+
scoop install quarto-prerelease
5442
} else {
55-
Invoke-Expression -Command "scoop install quarto@$version"
56-
if ($LASTEXITCODE -ne 0) {
57-
Write-Error "Failed to install quarto version $version with exit code $LASTEXITCODE"
58-
exit 1
59-
}
43+
scoop install quarto@$version
6044
}
61-
62-
exit 0

0 commit comments

Comments
 (0)