fix: Improve error handling and diagnostics in install-remote.sh

Enhanced the extract_repository function to properly capture and display
unzip error messages, helping diagnose extraction failures during remote
installation.

Changes:
- Capture unzip output in variable for better error reporting
- Display detailed error messages when extraction fails
- Improve ZIP integrity test error handling

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-10-01 22:44:13 +08:00
parent 4a75787d31
commit 260eb8283d

View File

@@ -138,7 +138,8 @@ function extract_repository() {
fi
# Try to extract
if unzip -q "$zip_path" -d "$temp_dir" 2>&1; then
local unzip_output
if unzip_output=$(unzip -q "$zip_path" -d "$temp_dir" 2>&1); then
# Find the extracted directory (usually repo-name-branch)
local repo_dir
repo_dir=$(find "$temp_dir" -maxdepth 1 -type d -name "Claude-Code-Workflow-*" | head -n 1)
@@ -155,8 +156,13 @@ function extract_repository() {
fi
else
write_color "Extraction failed" "$COLOR_ERROR"
if [ -n "$unzip_output" ]; then
write_color "Error details: $unzip_output" "$COLOR_ERROR"
fi
write_color "Testing zip file integrity..." "$COLOR_INFO"
unzip -t "$zip_path"
if ! unzip -t "$zip_path" 2>&1; then
write_color "ZIP file is corrupted" "$COLOR_ERROR"
fi
return 1
fi
}