diff options
| -rwxr-xr-x | archsetup | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -493,10 +493,15 @@ retry_install() { display "task" "installing $pkg via $source" while [ $attempt -le $MAX_INSTALL_RETRIES ]; do - if eval "$cmd" >> "$logfile" 2>&1; then + # Capture $? from eval directly. A naked `last_exit_code=$?` after + # `if eval; then ...; fi` reads the if-compound's exit status, which + # bash defines as 0 when no condition tested true — so a failing + # eval gets logged as "error code: 0" downstream. + eval "$cmd" >> "$logfile" 2>&1 + last_exit_code=$? + if [ $last_exit_code -eq 0 ]; then return 0 fi - last_exit_code=$? attempt=$((attempt + 1)) if [ $attempt -le $MAX_INSTALL_RETRIES ]; then display "task" "retrying $pkg (attempt $attempt/$MAX_INSTALL_RETRIES)" |
