fix(session-start): perl fallback runner kills the command's process group

alarm then exec killed one process: a child holding the captured pipe kept the 2 s bound open. perl now leads its own group, kills it at the deadline and TERMs leftovers; SD19/SD19b assert the bound and that the command ran.
This commit is contained in:
bchanot committed 2026-11-14 11:27:15 +01:00
1 parent cce1a1304c
commit 490ad8353d
2 files changed
+32 -3

No files matched your search

+17 -1
View File
@@ -344,14 +344,30 @@ for c in bash git cat sed awk grep tail head cut dirname readlink wc tr \
done
cat > "$WORK/sd9/lib/memory.sh" <<'EOF'
#!/usr/bin/env bash
echo "memory: v1: x" >&2
( sleep 8 ) &
exec sleep 8
EOF
p=$(mkproj sd19)
SECONDS=0
(cd "$p" && PATH="$bin" bash "$S9" </dev/null >/dev/null 2>&1)
out=$(cd "$p" && PATH="$bin" bash "$S9" </dev/null 2>&1)
check SD19-no-timeout-bin "$(PATH="$bin" command -v timeout gtimeout \
| wc -l | tr -d ' ')" 0
check SD19-perl-bounds-hang "$([ "$SECONDS" -lt 6 ] && echo yes || echo no)" yes
check SD19-command-ran "$(printf '%s' "$out" | grep -c 'registry v1: 1 file(s)')" 1
# SD19b: a background child outlives the command (straggler holding stderr)
cat > "$WORK/sd9/lib/memory.sh" <<'EOF'
#!/usr/bin/env bash
echo "memory: v1: x" >&2
( sleep 8 ) &
exit 0
EOF
p=$(mkproj sd19b)
SECONDS=0
out=$(cd "$p" && PATH="$bin" bash "$S9" </dev/null 2>&1)
check SD19b-perl-bounds-straggler "$([ "$SECONDS" -lt 6 ] && echo yes || echo no)" yes
check SD19b-command-ran "$(printf '%s' "$out" | grep -c 'registry v1: 1 file(s)')" 1
printf 'session-digest: %d passed, %d failed\n' "$pass" "$fail"
[ "$fail" -eq 0 ]