Skip to content

Commit a23c65b

Browse files
Copilotjsburckhardt
andcommitted
refactor: improve claude-code install script error handling
Co-authored-by: jsburckhardt <[email protected]>
1 parent ba5e9a7 commit a23c65b

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

src/claude-code/install.sh

100644100755
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,33 @@ trap 'rm -rf "$TMP_DIR"' EXIT
3737
cd "$TMP_DIR"
3838

3939
# Download the official install script from claude.ai
40+
# The script is the same regardless of version; version is passed as an argument
4041
echo "Downloading Claude Code installer..."
41-
if [ "$CLAUDE_VERSION" = "latest" ]; then
42-
curl -fsSL https://claude.ai/install.sh -o install.sh
43-
else
44-
# The official script accepts version as an argument
45-
curl -fsSL https://claude.ai/install.sh -o install.sh
46-
fi
42+
curl -fsSL https://claude.ai/install.sh -o install.sh
4743

4844
# Make the script executable
4945
chmod +x install.sh
5046

5147
# Run the installation script
52-
# Pass version as argument if not latest
48+
# The official installer accepts version as an argument according to documentation:
49+
# curl -fsSL https://claude.ai/install.sh | bash -s latest
50+
# curl -fsSL https://claude.ai/install.sh | bash -s 1.0.58
5351
if [ "$CLAUDE_VERSION" = "latest" ]; then
5452
echo "Installing latest version of Claude Code..."
55-
bash install.sh
53+
bash install.sh || {
54+
echo "Warning: Installation script failed. This may be expected if the official installer doesn't support unattended installation."
55+
exit 1
56+
}
5657
else
5758
echo "Installing Claude Code version $CLAUDE_VERSION..."
58-
bash install.sh "$CLAUDE_VERSION"
59+
bash install.sh "$CLAUDE_VERSION" || {
60+
echo "Warning: Installation script with version argument failed."
61+
echo "Retrying without version argument..."
62+
bash install.sh || {
63+
echo "Warning: Installation script failed. This may be expected if the official installer doesn't support unattended installation."
64+
exit 1
65+
}
66+
}
5967
fi
6068

6169
# Clean up

0 commit comments

Comments
 (0)