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
|
# Try to download pre-built binary with integrity verification
|
||||||
download_binary() {
|
download_binary() {
|
||||||
local os=$(detect_os)
|
local os arch binary_name binary_url checksum_url
|
||||||
local arch=$(detect_arch)
|
os=$(detect_os)
|
||||||
local binary_name="core-${os}-${arch}"
|
arch=$(detect_arch)
|
||||||
local binary_url="https://github.com/$REPO/releases/download/$VERSION/${binary_name}"
|
binary_name="core-${os}-${arch}"
|
||||||
local checksum_url="https://github.com/$REPO/releases/download/$VERSION/checksums.txt"
|
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
|
if [[ "$os" == "windows" ]]; then
|
||||||
binary_name="${binary_name}.exe"
|
binary_name="${binary_name}.exe"
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,9 @@ function Install-Chocolatey {
|
||||||
|
|
||||||
Write-Info "Executing Chocolatey installer..."
|
Write-Info "Executing Chocolatey installer..."
|
||||||
& $tempScript
|
& $tempScript
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Err "Chocolatey installation failed with exit code $LASTEXITCODE"
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
# Clean up temp file
|
# Clean up temp file
|
||||||
if (Test-Path $tempScript) {
|
if (Test-Path $tempScript) {
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,10 @@ install_brew() {
|
||||||
error "Failed to download Homebrew installer"
|
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"
|
rm -f "$temp_script"
|
||||||
|
|
||||||
# Add to PATH for this session
|
# Add to PATH for this session
|
||||||
|
|
@ -232,7 +235,10 @@ setup_linux_apt() {
|
||||||
error "Failed to download NodeSource setup script"
|
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"
|
rm -f "$temp_script"
|
||||||
sudo apt-get install -y nodejs
|
sudo apt-get install -y nodejs
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue