Skip to content

Commit 9314bbb

Browse files
Improve error handling for download failures in install script
1 parent 15711dc commit 9314bbb

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

install-cli.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,22 @@ else
6161
fi
6262

6363
# --- Download and Extract ---
64-
# The download is a .tar.gz file which needs to be extracted
64+
# The download is a .tar.gz or .zip file which needs to be extracted
6565
if [ "$CLI_OS" = "windows" ]; then
6666
URL="https://github.com/kosli-dev/cli/releases/download/${VERSION}/kosli_${VERSION_FILENAME}_${CLI_OS}_${ARCH}.zip"
67+
# Download and extract for Windows
68+
if ! curl -L --fail "$URL" -o kosli.zip; then
69+
echo "Error: Download failed. Please check the URL and your network connection."
70+
exit 1
71+
fi
72+
unzip -o kosli.zip
6773
else
6874
URL="https://github.com/kosli-dev/cli/releases/download/${VERSION}/kosli_${VERSION_FILENAME}_${CLI_OS}_${ARCH}.tar.gz"
69-
fi
70-
echo "Downloading from: $URL"
71-
72-
# Download and extract in one go
73-
if ! curl -L --fail "$URL" | tar zx; then
74-
echo "Error: Download or extraction failed. Please check the URL and your network connection."
75-
exit 1
75+
# Download and extract for Linux and Darwin
76+
if ! curl -L --fail "$URL" | tar zx; then
77+
echo "Error: Download or extraction failed. Please check the URL and your network connection."
78+
exit 1
79+
fi
7680
fi
7781

7882
# --- Installation ---

0 commit comments

Comments
 (0)