Skip to content

Commit

Permalink
Fix: curl check statu code
Browse files Browse the repository at this point in the history
  • Loading branch information
zijiren233 committed Jun 23, 2024
1 parent 78337ae commit d9301e4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion script/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@ function InitDownloadTools() {
function Download() {
case "$download_tool" in
curl)
curl -L "$1" -o "$2" --progress-bar
status_code=$(curl -L "$1" -o "$2" --progress-bar -w "%{http_code}\n")
if [ $? -ne 0 ]; then
echo "download $1 failed"
exit 1
fi
if [ "$status_code" != "200" ]; then
echo "download $1 failed, status code: $status_code"
exit 1
fi
;;
wget)
wget -O "$2" "$1"
Expand Down

0 comments on commit d9301e4

Please sign in to comment.