Skip to content

Commit a467893

Browse files
committed
wip:debugging ci
1 parent 48753af commit a467893

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

scripts/multinode-runner.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ EOF
145145
cleanup() {
146146
# CRITICAL: Capture the original exit code immediately
147147
# This must be the FIRST command in cleanup to preserve test results
148-
exit_code=$?
148+
local exit_code=$?
149149
log "Cleaning up test processes (exit code: $exit_code)..."
150150

151151
local cleaned_count=0
@@ -208,7 +208,7 @@ cleanup() {
208208
fi
209209

210210
# Kill all spawned node processes
211-
if [[ ${#CLEANUP_PIDS[@]} -gt 0 ]]; then
211+
if [[ -n "${CLEANUP_PIDS[*]:-}" ]]; then
212212
log "Cleaning up ${#CLEANUP_PIDS[@]} node processes"
213213
local failed_kills=()
214214
for pid in "${CLEANUP_PIDS[@]}"; do
@@ -221,7 +221,7 @@ cleanup() {
221221
fi
222222
done
223223

224-
if [[ ${#failed_kills[@]} -gt 0 ]]; then
224+
if [[ -n "${failed_kills[*]:-}" ]]; then
225225
cleanup_failures+=("Failed to send SIGTERM to node PIDs: ${failed_kills[*]}")
226226
fi
227227

@@ -245,10 +245,10 @@ cleanup() {
245245
fi
246246
done
247247

248-
if [[ ${#force_killed[@]} -gt 0 ]]; then
248+
if [[ -n "${force_killed[*]:-}" ]]; then
249249
cleanup_failures+=("Node PIDs required force-kill after ${node_grace_period}s: ${force_killed[*]}")
250250
fi
251-
if [[ ${#still_running[@]} -gt 0 ]]; then
251+
if [[ -n "${still_running[*]:-}" ]]; then
252252
cleanup_failures+=("Failed to kill node PIDs: ${still_running[*]}")
253253
fi
254254
fi
@@ -294,7 +294,8 @@ cleanup() {
294294

295295
# Report cleanup issues if any occurred
296296
# These are informational only and don't affect the test result
297-
if [[ ${#cleanup_failures[@]} -gt 0 ]]; then
297+
# Check if array has any elements before accessing
298+
if [[ -n "${cleanup_failures[*]:-}" ]]; then
298299
echo "" >&2
299300
echo "=== Cleanup Issues Report (non-fatal) ===" >&2
300301
echo "The following cleanup operations had issues:" >&2

0 commit comments

Comments
 (0)