fix: address CodeRabbit review feedback
- Separate local declaration from assignment to avoid masking errors (SC2155) - Add exit code check after Homebrew installer execution - Add exit code check after NodeSource setup script execution - Add LASTEXITCODE check after Chocolatey installer execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d9a8fe279e
commit
15778b7a5f
3 changed files with 17 additions and 7 deletions
|
|
@ -99,11 +99,12 @@ check_not_symlink() {
|
|||
|
||||
# Try to download pre-built binary with integrity verification
|
||||
download_binary() {
|
||||
local os=$(detect_os)
|
||||
local arch=$(detect_arch)
|
||||
local binary_name="core-${os}-${arch}"
|
||||
local binary_url="https://github.com/$REPO/releases/download/$VERSION/${binary_name}"
|
||||
local checksum_url="https://github.com/$REPO/releases/download/$VERSION/checksums.txt"
|
||||
local os arch binary_name binary_url checksum_url
|
||||
os=$(detect_os)
|
||||
arch=$(detect_arch)
|
||||
binary_name="core-${os}-${arch}"
|
||||
binary_url="https://github.com/$REPO/releases/download/$VERSION/${binary_name}"
|
||||
checksum_url="https://github.com/$REPO/releases/download/$VERSION/checksums.txt"
|
||||
|
||||
if [[ "$os" == "windows" ]]; then
|
||||
binary_name="${binary_name}.exe"
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ function Install-Chocolatey {
|
|||
|
||||
Write-Info "Executing Chocolatey installer..."
|
||||
& $tempScript
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Err "Chocolatey installation failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
# Clean up temp file
|
||||
if (Test-Path $tempScript) {
|
||||
|
|
|
|||
|
|
@ -88,7 +88,10 @@ install_brew() {
|
|||
error "Failed to download Homebrew installer"
|
||||
}
|
||||
|
||||
/bin/bash "$temp_script"
|
||||
/bin/bash "$temp_script" || {
|
||||
rm -f "$temp_script"
|
||||
error "Homebrew installation failed"
|
||||
}
|
||||
rm -f "$temp_script"
|
||||
|
||||
# Add to PATH for this session
|
||||
|
|
@ -232,7 +235,10 @@ setup_linux_apt() {
|
|||
error "Failed to download NodeSource setup script"
|
||||
}
|
||||
|
||||
sudo -E bash "$temp_script"
|
||||
sudo -E bash "$temp_script" || {
|
||||
rm -f "$temp_script"
|
||||
error "NodeSource setup failed"
|
||||
}
|
||||
rm -f "$temp_script"
|
||||
sudo apt-get install -y nodejs
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue