$LASTEXITPR 오류

This commit is contained in:
Jerry Chae committed 2026-05-13 20:07:06 +09:00
1 parent eb52bbd9d3
commit fc8faeafa5
1 file changed
+4 -12
+4 -12
View File
@@ -120,13 +120,10 @@ Info "Installing Pi Coding Agent..."
$piCmd = Get-Command pi -ErrorAction SilentlyContinue $piCmd = Get-Command pi -ErrorAction SilentlyContinue
if ($piCmd) { if ($piCmd) {
$currentVer = & pi --version 2>$null $currentVer = & pi --version 2>$null
if ($LASTEXITPR -ne 0) { $currentVer = "unknown" } if (-not $currentVer) { $currentVer = "unknown" }
Info "Pi is already installed (version: $currentVer). Skipping installation." Info "Pi is already installed (version: $currentVer). Skipping installation."
} else { } else {
npm install -g $PI_NPM_PACKAGE npm install -g $PI_NPM_PACKAGE 2>&1 | Out-Null
if ($LASTEXITPR -ne 0) {
ErrExit "Pi installation failed."
}
Success "Pi installed via npm" Success "Pi installed via npm"
} }
@@ -153,7 +150,7 @@ if (-not $piBin) {
# 3) Try common npm global locations # 3) Try common npm global locations
if (-not $piBin) { if (-not $piBin) {
$npmPrefix = & npm config get prefix 2>$null $npmPrefix = & npm config get prefix 2>$null
if ($LASTEXITPR -eq 0 -and $npmPrefix) { if (-not [string]::IsNullOrEmpty($npmPrefix)) {
$candidate = Join-Path $npmPrefix 'pi.cmd' $candidate = Join-Path $npmPrefix 'pi.cmd'
if (Test-Path $candidate) { $piBin = $candidate } if (Test-Path $candidate) { $piBin = $candidate }
if (-not $piBin) { if (-not $piBin) {
@@ -228,12 +225,7 @@ if ($SkipPackages) {
Info "[$count/$total] $name - $desc" Info "[$count/$total] $name - $desc"
try { try {
& $piBin install "npm:$name" 2>&1 | Out-Null & $piBin install "npm:$name" 2>&1 | Out-Null
if ($LASTEXITPR -eq 0) { Success " -> $name installed"
Success " -> $name installed"
} else {
Warn " -> $name failed (install manually later: pi install npm:$name)"
$failed += $name
}
} catch { } catch {
Warn " -> $name failed (install manually later: pi install npm:$name)" Warn " -> $name failed (install manually later: pi install npm:$name)"
$failed += $name $failed += $name