From 9bb9c05596693466fd8ce0fddcdef290dc6f9675 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sun, 8 Nov 2026 23:06:19 +0100 Subject: [PATCH] =?UTF-8?q?Answer=20stability=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1=20(0=20misread);=20check=20the?= =?UTF-8?q?=20exit=20status,=20chain=20the=20kill,=20close=20the=20timeout?= =?UTF-8?q?=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci.sh | 13 +++++-------- docker-runner.sh | 1 + 2 files changed, 6 insertions(+), 8 deletions(-) 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