diff --git a/ci.sh b/ci.sh index 87d63d2..27ae3af 100755 --- a/ci.sh +++ b/ci.sh @@ -45,25 +45,22 @@ boundaries_fire() { leg "import boundaries fire ($node_image)" boundaries_fire -# Without `docker run --init`, process 1 ignores the SIGINT docker forwards and the container runs to its end. interrupt_stops_container() { - local pid ready started waited=0 + local pid ready status=0 waited=0 ready=$(mktemp) || return 1 in_image "$node_image" sh -c 'echo ready; sleep 60' > "$ready" & pid=$! until grep -q ready "$ready"; do waited=$((waited + 1)) - [ "$waited" -le 300 ] || return 1 + [ "$waited" -le 300 ] || { kill -INT "$pid"; rm -f "$ready"; return 1; } sleep 0.2 done - kill -INT "$pid" - started=$SECONDS - wait "$pid" || true + kill -INT "$pid" && wait "$pid" || status=$? rm -f "$ready" - [ $((SECONDS - started)) -lt 20 ] + [ "$status" -eq 130 ] } -leg "Ctrl-C stops a leg's container ($node_image)" interrupt_stops_container +leg "Ctrl-C stops an in_image container ($node_image)" interrupt_stops_container test_log=$(mktemp) node_tests() { diff --git a/docker-runner.sh b/docker-runner.sh index e76243f..98c0aa7 100644 --- a/docker-runner.sh +++ b/docker-runner.sh @@ -6,6 +6,7 @@ firefox_image=selenium/standalone-firefox:159.0.1 floor_image=node:18.20.8-alpine3.21 node_image=node:26.13.0-alpine3.24 +# --init: the container's process 1 ignores a SIGINT it has no handler for, so without it Ctrl-C leaves the container running. in_image() { local image=$1 entrypoint=$2 shift 2