From 368cd02b6d7e42b208232cb379de0338d14f1d64 Mon Sep 17 00:00:00 2001 From: Space-Banane Date: Mon, 6 Apr 2026 23:15:52 +0200 Subject: [PATCH] refactor: improve timeout handling in execution tests for better reliability --- .gitea/workflows/python-syntax.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/python-syntax.yml b/.gitea/workflows/python-syntax.yml index b2fb672..672a72f 100644 --- a/.gitea/workflows/python-syntax.yml +++ b/.gitea/workflows/python-syntax.yml @@ -60,8 +60,11 @@ jobs: monitor_pid=$! # Wait up to 5s for the process to exit (or be killed by the monitor) - timeout 5s wait $pid 2>/dev/null || true - status=$? + if timeout 5s bash -c 'while kill -0 "$1" 2>/dev/null; do sleep 0.1; done' _ "$pid"; then + status=0 + else + status=$? + fi # Stop the monitor and cleanup kill $monitor_pid 2>/dev/null || true @@ -95,8 +98,11 @@ jobs: fi # Default behavior for other files: try --version with a 5s timeout - timeout 5s python "$file" --version - status=$? + if timeout 5s python "$file" --version; then + status=0 + else + status=$? + fi # If it ran successfully, continue if [ $status -eq 0 ]; then