Skip to content

Commit 7b182a4

Browse files
committed
Fix exit code checks and error handling in PowerShell install script
- on windows, building extension step fails ├── install.ps1 └── install.sh
1 parent a4a81d1 commit 7b182a4

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎install.ps1‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ $extractedDir = Join-Path $tmpDir "source"
173173
$spinner = Start-Spinner "Cloning repository..."
174174
$ErrorActionPreference = "Continue"
175175
git clone -c core.longpaths=true --quiet https://github.com/robertpiosik/CodeWebChat.git $extractedDir *>$null
176-
$cmdSuccess = $?
176+
$cmdSuccess = ($LASTEXITCODE -eq 0)
177177
$ErrorActionPreference = "Stop"
178178
Stop-Spinner $spinner $cmdSuccess
179179

@@ -188,7 +188,7 @@ Push-Location $extractedDir
188188
$spinner = Start-Spinner "Installing dependencies..."
189189
$ErrorActionPreference = "Continue"
190190
npx.cmd --yes pnpm install *>$null
191-
$cmdSuccess = $?
191+
$cmdSuccess = ($LASTEXITCODE -eq 0)
192192
Stop-Spinner $spinner $cmdSuccess
193193

194194
if (!$cmdSuccess) {
@@ -200,7 +200,7 @@ if (!$cmdSuccess) {
200200
$spinner = Start-Spinner "Building extension..."
201201
Set-Location apps/editor
202202
npx.cmd --yes pnpm run build *>$null
203-
$cmdSuccess = $?
203+
$cmdSuccess = ($LASTEXITCODE -eq 0)
204204
$ErrorActionPreference = "Stop"
205205
Stop-Spinner $spinner $cmdSuccess
206206

@@ -211,7 +211,7 @@ if (!$cmdSuccess) {
211211
exit 1
212212
}
213213

214-
$vsixFile = Get-ChildItem *.vsix | Select-Object -First 1
214+
$vsixFile = Get-ChildItem *.vsix -ErrorAction SilentlyContinue | Select-Object -First 1
215215

216216
if (!$vsixFile) {
217217
Write-Host "Error: VSIX file was not generated." -ForegroundColor Red
@@ -227,7 +227,7 @@ function Install-ToEditor($idx) {
227227
$spinner = Start-Spinner "Installing to $editorName..."
228228
$ErrorActionPreference = "Continue"
229229
& $editorCmd --install-extension $vsixFile.FullName --force *>$null
230-
$cmdSuccess = $?
230+
$cmdSuccess = ($LASTEXITCODE -eq 0)
231231
$ErrorActionPreference = "Stop"
232232

233233
Stop-Spinner $spinner $cmdSuccess

0 commit comments

Comments
 (0)