From d9301e4e63e22f0220a2a86e5e3be101d09d2724 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Mon, 24 Jun 2024 00:07:01 +0800 Subject: [PATCH] Fix: curl check statu code --- script/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/install.sh b/script/install.sh index 1bc176ce..eb49397b 100755 --- a/script/install.sh +++ b/script/install.sh @@ -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"