Skip to content

Commit 1c0f087

Browse files
committed
fix for timeout error
1 parent cdca21f commit 1c0f087

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

.github/workflows/test-scripts.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,26 @@ jobs:
112112
echo "Testing: mac/run.sh --silent $test_type $tech_stack"
113113
echo "================================"
114114
115-
# Run with timeout and capture exit code (non-blocking)
116-
timeout 60 bash mac/run.sh --silent "$test_type" "$tech_stack" >> "/tmp/run_test_${test_type}_${tech_stack}.log" 2>&1 &
115+
# Run with timeout and capture exit code (macOS compatible)
116+
bash mac/run.sh --silent "$test_type" "$tech_stack" >> "/tmp/run_test_${test_type}_${tech_stack}.log" 2>&1 &
117117
job_pid=$!
118-
wait "$job_pid" || exit_code=$?
118+
119+
# Wait with 60 second timeout using sleep loop (macOS compatible)
120+
count=0
121+
max_wait=60
122+
while kill -0 "$job_pid" 2>/dev/null && [ $count -lt $max_wait ]; do
123+
sleep 1
124+
count=$((count + 1))
125+
done
126+
127+
# Check if process is still running after timeout
128+
if kill -0 "$job_pid" 2>/dev/null; then
129+
echo "⚠️ mac/run.sh --silent $test_type $tech_stack timed out after 60 seconds"
130+
kill -9 "$job_pid" 2>/dev/null || true
131+
exit_code=124
132+
else
133+
wait "$job_pid" || exit_code=$?
134+
fi
119135
120136
if [ -z "$exit_code" ] || [ "$exit_code" -eq 0 ] || [ "$exit_code" -eq 124 ]; then
121137
echo "✅ mac/run.sh --silent $test_type $tech_stack completed (exit code: ${exit_code:-0})"
@@ -134,7 +150,6 @@ jobs:
134150
test-windows:
135151
name: Test win/run.ps1 on Windows
136152
runs-on: windows-latest
137-
timeout-minutes: 30
138153
steps:
139154
- name: Checkout code
140155
uses: actions/checkout@v4
@@ -365,7 +380,7 @@ jobs:
365380
echo "Testing: mac/run.sh --silent $test_type $tech_stack"
366381
echo "================================"
367382
368-
# Run with timeout and capture exit code (non-blocking)
383+
# Run with timeout and capture exit code (using timeout command on Linux)
369384
timeout 60 bash mac/run.sh --silent "$test_type" "$tech_stack" >> "/tmp/run_test_${test_type}_${tech_stack}.log" 2>&1 &
370385
job_pid=$!
371386
wait "$job_pid" || exit_code=$?

0 commit comments

Comments
 (0)