Fiks run-tasks.sh: unngå set -e krasj ved exitkode-håndtering

((completed++)) returnerer 1 når completed=0 under set -e.
Bytter til $((x + 1)) og fanger exitkode med || exit_code=$?.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
vegard 2026-03-17 22:21:11 +00:00
parent f0a590303a
commit 895f517d9d

View file

@ -48,11 +48,11 @@ while true; do
echo "" echo ""
# Kjør oppgaven # Kjør oppgaven
./scripts/run-next-task.sh exit_code=0
exit_code=$? ./scripts/run-next-task.sh || exit_code=$?
if [[ $exit_code -eq 0 ]]; then if [[ $exit_code -eq 0 ]]; then
((completed++)) completed=$((completed + 1))
api_failures=0 # Nullstill ved suksess api_failures=0 # Nullstill ved suksess
echo "" echo ""
echo "--- Oppgave ferdig (#$completed). Neste om ${INTERVAL}s (Ctrl-C for å stoppe) ---" echo "--- Oppgave ferdig (#$completed). Neste om ${INTERVAL}s (Ctrl-C for å stoppe) ---"
@ -71,7 +71,7 @@ while true; do
fi fi
# Oppgaven ble tilbakestilt til [ ] — sannsynligvis API-feil # Oppgaven ble tilbakestilt til [ ] — sannsynligvis API-feil
((api_failures++)) api_failures=$((api_failures + 1))
if [[ $api_failures -ge $MAX_API_RETRIES ]]; then if [[ $api_failures -ge $MAX_API_RETRIES ]]; then
echo "" echo ""
echo "--- $MAX_API_RETRIES feil på rad. Stopper. ---" echo "--- $MAX_API_RETRIES feil på rad. Stopper. ---"