From dac96294994b7ed8f08bfc4f0dcc1dbe5ee54e14 Mon Sep 17 00:00:00 2001 From: frankbria Date: Fri, 5 Sep 2025 08:37:21 -0700 Subject: [PATCH] Fix exit condition logic in ralph_loop.sh - Eliminate double function call in should_exit_gracefully check - Use consistent string return pattern instead of mixed return codes - Resolves script error on line 280 with exit code handling --- ralph_loop.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ralph_loop.sh b/ralph_loop.sh index 02be99d..09b086d 100755 --- a/ralph_loop.sh +++ b/ralph_loop.sh @@ -287,7 +287,7 @@ should_exit_gracefully() { fi log_status "INFO" "DEBUG: No exit conditions met, continuing loop" >&2 - return 1 # Don't exit + echo "" # Return empty string instead of using return code } # Main execution function @@ -440,8 +440,8 @@ main() { fi # Check for graceful exit conditions - if should_exit_gracefully; then - local exit_reason=$(should_exit_gracefully) + local exit_reason=$(should_exit_gracefully) + if [[ "$exit_reason" != "" ]]; then log_status "SUCCESS" "🏁 Graceful exit triggered: $exit_reason" update_status "$loop_count" "$(cat "$CALL_COUNT_FILE")" "graceful_exit" "completed" "$exit_reason"