Update core.func

This commit is contained in:
CanbiZ 2025-05-07 16:01:33 +02:00
parent 1ad7b1ae8c
commit 46859a11d0

View File

@ -1,6 +1,7 @@
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# License: MIT | https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/LICENSE # License: MIT | https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/LICENSE
set -euo pipefail
SPINNER_PID="" SPINNER_PID=""
SPINNER_ACTIVE=0 SPINNER_ACTIVE=0
SPINNER_MSG="" SPINNER_MSG=""
@ -87,16 +88,19 @@ community_curl() {
exit_code=$? exit_code=$?
if [[ $exit_code -eq 0 ]]; then if [[ $exit_code -eq 0 ]]; then
stop_spinner
msg_ok "Fetched: $url"
printf '%s' "$result" printf '%s' "$result"
return 0 return 0
fi fi
if ((attempt >= max_retries)); then if ((attempt >= max_retries)); then
stop_spinner
__curl_err_handler "$exit_code" __curl_err_handler "$exit_code"
return 1 return 1
fi fi
# inline retry message (overwrite line) # Print retry inline
printf "\r\033[K${INFO}${YW}Retry $attempt/$max_retries in ${delay}s...${CL}" >&2 printf "\r\033[K${INFO}${YW}Retry $attempt/$max_retries in ${delay}s...${CL}" >&2
sleep "$delay" sleep "$delay"
((attempt++)) ((attempt++))