The withdrawal last iteration was caused by `rm -f /tmp/xenia-canary.lock` -- the obvious way past a lock orphaned by kill -9, which also disables the guard for every later launch. Three instances ended up live at once, sharing /tmp/xenia_pad.txt and display :98, and silently confounded an input experiment. Care is not a fix, so this is tooling. ensure_single_emulator.sh counts live instances, stops them (plain kill, then -9, each with a bounded wait), verifies ZERO, and only then removes the lock -- refusing loudly if any remain. The lock is never removed before the condition it guards against is verified absent. FOUR scripts did the bare `rm -f`, and only two were mine from today: menu_loop_session.sh, title_draw_capture.sh, poke_control.sh and resume_reliability.sh. So the footgun was corpus-wide rather than introduced this session. All four now route through the guard. The guard is controlled rather than assumed: run against a deliberately started live instance it reports "1 instance(s) live -- stopping them", ends at 0 with the lock cleared, and exits 0. A guard that only ever passes on an already-clean slate would prove nothing. It also kills by process NAME. `pkill -f xenia_canary` matches the shell running it -- that has now cost this corpus three commands, one of them a cleanup that died halfway and left the very instances it was meant to remove. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wuu56cE8vJGTBtn1ppsk8v
23 lines
1.1 KiB
Bash
Executable File
23 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Boot, then run menu_loop_probe.py. Asserts the emulator is ALIVE before the
|
|
# probe enters its wait loop -- a previous run polled a dead display for 484 s
|
|
# because run-canary had refused on a lockfile orphaned by `kill -9`, and
|
|
# "no emulator" is indistinguishable from "not the title yet" to a classifier.
|
|
set -u
|
|
export HOME=/sylph-home/re SDL_AUDIODRIVER=dummy DISPLAY=:98
|
|
SD="$(cd "$(dirname "$0")" && pwd)"
|
|
OUT="${1:-/sylph-home/re/menuloop3}"; mkdir -p "$OUT"
|
|
ps -o pid= -C xenia_canary | xargs -r kill # plain kill: it clears its own lock
|
|
. "$(dirname "${BASH_SOURCE[0]}")/ensure_single_emulator.sh"
|
|
ensure_single_emulator || exit 3
|
|
( cd "$OUT" && nohup run-canary --mem_watch=false \
|
|
--logged_profile_slot_0_xuid=B13EBABEBABEBABE \
|
|
>"$OUT/canary.stdout" 2>"$OUT/canary.stderr" & )
|
|
sleep 10
|
|
if ! ps -C xenia_canary >/dev/null 2>&1; then
|
|
echo "EMULATOR DID NOT START -- stderr says:"; tail -3 "$OUT/canary.stderr"; exit 4
|
|
fi
|
|
echo "emulator alive, starting probe"
|
|
timeout 900 python3 "$SD/menu_loop_probe.py" "$OUT" 780
|
|
echo "MENU LOOP PROBE DONE"
|