refactor: improve timeout handling in execution tests for better reliability
All checks were successful
Code Check - Quality and Syntax / syntax-lint (3.11) (push) Successful in 10s
Code Check - Quality and Syntax / syntax-lint (3.12) (push) Successful in 11s
Code Check - Quality and Syntax / syntax-lint (3.13) (push) Successful in 17s
Code Check - Quality and Syntax / syntax-lint (3.14) (push) Successful in 11s
All checks were successful
Code Check - Quality and Syntax / syntax-lint (3.11) (push) Successful in 10s
Code Check - Quality and Syntax / syntax-lint (3.12) (push) Successful in 11s
Code Check - Quality and Syntax / syntax-lint (3.13) (push) Successful in 17s
Code Check - Quality and Syntax / syntax-lint (3.14) (push) Successful in 11s
This commit is contained in:
@@ -60,8 +60,11 @@ jobs:
|
|||||||
monitor_pid=$!
|
monitor_pid=$!
|
||||||
|
|
||||||
# Wait up to 5s for the process to exit (or be killed by the monitor)
|
# Wait up to 5s for the process to exit (or be killed by the monitor)
|
||||||
timeout 5s wait $pid 2>/dev/null || true
|
if timeout 5s bash -c 'while kill -0 "$1" 2>/dev/null; do sleep 0.1; done' _ "$pid"; then
|
||||||
|
status=0
|
||||||
|
else
|
||||||
status=$?
|
status=$?
|
||||||
|
fi
|
||||||
|
|
||||||
# Stop the monitor and cleanup
|
# Stop the monitor and cleanup
|
||||||
kill $monitor_pid 2>/dev/null || true
|
kill $monitor_pid 2>/dev/null || true
|
||||||
@@ -95,8 +98,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Default behavior for other files: try --version with a 5s timeout
|
# Default behavior for other files: try --version with a 5s timeout
|
||||||
timeout 5s python "$file" --version
|
if timeout 5s python "$file" --version; then
|
||||||
|
status=0
|
||||||
|
else
|
||||||
status=$?
|
status=$?
|
||||||
|
fi
|
||||||
|
|
||||||
# If it ran successfully, continue
|
# If it ran successfully, continue
|
||||||
if [ $status -eq 0 ]; then
|
if [ $status -eq 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user