Fix: curl check statu code

pull/198/head
zijiren233 8 months ago
parent 78337ae8c8
commit d9301e4e63

@ -143,11 +143,15 @@ function InitDownloadTools() {
function Download() { function Download() {
case "$download_tool" in case "$download_tool" in
curl) 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 if [ $? -ne 0 ]; then
echo "download $1 failed" echo "download $1 failed"
exit 1 exit 1
fi fi
if [ "$status_code" != "200" ]; then
echo "download $1 failed, status code: $status_code"
exit 1
fi
;; ;;
wget) wget)
wget -O "$2" "$1" wget -O "$2" "$1"

Loading…
Cancel
Save