Record the two shell traps that wedged session 2's background jobs

Eleven watcher shells and one MAME instance were left running for over an
hour. Both had the same shape: a wait that can never be satisfied.

- `until ! pgrep -f foo.py` matches the watching shell's own command line,
  so the loop never terminates. Wait on a PID or a sentinel file instead.
- `timeout N mame` sends a SIGTERM that MAME ignores when its autoboot
  script is blocked; without `-k` the process spins at 100% CPU forever.

Also gitignore vasm's default `a.out` output.

Claude-Session: https://claude.ai/code/session_01194oWYW8DQXK1SZ2DnChW6
This commit is contained in:
prosolis
2026-08-23 12:49:32 -07:00
parent 64cd1ffd72
commit 22c67f1cb8
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -117,6 +117,15 @@ notifier subscription in a global; the stack register is `SP` not `A7`;
- piping MAME (or any long job) through `grep` block-buffers — write to a file.
- `pkill -f <pattern>` matches your own shell and kills it (exit 144).
Use `pkill -x` or kill by PID.
- **`until ! pgrep -f foo.py; do sleep; done` watcher loops never exit.** The
watching shell's own command line contains the string `foo.py`, so `pgrep -f`
matches the watcher itself and the loop spins forever. Session 2 left 11 of
these wedged for over an hour. Wait on the PID (`while kill -0 $PID`) or on a
sentinel file the job touches when it finishes -- never on a `-f` name match.
- **`timeout N mame ...` does not kill MAME.** MAME catches SIGTERM and, with an
autoboot script blocked waiting on a flag that never arrives, never reaches
its shutdown path. `timeout` without `-k` then waits forever while MAME burns
a full core at `-nothrottle`. Always `timeout -k 5 N`.
---