test: the sweep ends test processes left behind by a killed run
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
A test run killed mid-test runs no destructor, so a server it had stopped (SIGSTOP, to show the CLI doesn't hang on one) stays stopped for good: one sat for a day. sweep-test-tmp, run before and after just check, now ends any wanderbooks process whose --root is a test (wb-*) dir that no longer exists, waking it first; the live books' processes have no test --root and are never matched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T3gXMVt7XJPi6ens1or9Dj
This commit is contained in:
1 file changed
+14
-2
@@ -39,9 +39,21 @@ server-only:
|
||||
# until 2026-10-17 many were removed only on pass, or never: 117,000 piled
|
||||
# up). A run killed mid-test (a mutant's timeout, ^C) runs no destructor,
|
||||
# so this sweep removes this user's test book dirs older than an hour; a
|
||||
# run in progress elsewhere keeps its own.
|
||||
# run in progress elsewhere keeps its own. Such a run can also leave its
|
||||
# processes behind: a wanderbooks process whose `--root` is a test dir
|
||||
# (a `wb-*` dir) that no longer exists is ended, woken first (a test may
|
||||
# have stopped it with SIGSTOP; 2026-10-23, one sat stopped for a day).
|
||||
# Only such a process: the live books' processes have no test `--root`.
|
||||
sweep-test-tmp:
|
||||
@find "${TMPDIR:-/tmp}" /tmp -maxdepth 1 -user "$(id -u)" -type d -mmin +60 \( -name 'wb-*' -o -name 'wanderbooks-*' -o -name 'ledger-*' \) -exec rm -rf {} + 2>/dev/null || true
|
||||
#!/usr/bin/env bash
|
||||
find "${TMPDIR:-/tmp}" /tmp -maxdepth 1 -user "$(id -u)" -type d -mmin +60 \( -name 'wb-*' -o -name 'wanderbooks-*' -o -name 'ledger-*' \) -exec rm -rf {} + 2>/dev/null || true
|
||||
for pid in $(pgrep -u "$(id -u)" -x wanderbooks; pgrep -u "$(id -u)" -f '^wanderbooks (server|host|mcp|serve) '); do
|
||||
root=$(tr '\0' '\n' < "/proc/$pid/cmdline" 2>/dev/null | sed -n '/^--root$/{n;p;q}')
|
||||
case "$root" in
|
||||
*/wb-*/*|*/wb-*) [ -e "$root" ] || { kill -CONT "$pid"; kill -KILL "$pid"; } 2>/dev/null ;;
|
||||
esac
|
||||
done
|
||||
true
|
||||
|
||||
# The Kani harnesses `prove` leaves to `prove-slow`: each takes four to
|
||||
# twenty minutes alone on a busy machine, and with them the suite (about
|
||||
|
||||
Reference in new issue
Block a user