← ClaudeAtlas

detached-childlisted

Use when a self-test passes in a Linux container and fails on Windows with WinError 32 at TemporaryDirectory cleanup. A detached child inherited the tempdir as its cwd; fix the product, not the test.
MrBinnacle/skills · ★ 0 · AI & Automation · score 68
Install: claude install-skill MrBinnacle/skills
# Container-green, host-red: a detached child holds the test's tempdir ## Problem A factory/CI gate runs a hook's self-test inside a Linux container and reports green. The hook is then wired into `settings.json` (and its self-test into the session receiver checks) on a Windows host. On that host the same suite exits 1 part-way through: the first block of checks prints `ok`, then a `PermissionError [WinError 32]` traceback from `tempfile.TemporaryDirectory.__exit__`, and every later check never runs. The receiver now rejects the next session packet on a "trusted check" that never reached its second case. Observed 2026-08-29 in a private steering repository (board-drift sweep hooks): 19/19 gate checks green in-container; on the host 15/57, then abort. ## Context / Trigger Conditions - Windows host; Python 3.12/3.13; suite uses `tempfile.TemporaryDirectory()` per test. - The code under test launches a long-lived detached child: `subprocess.Popen([...], start_new_session=True)` with no `cwd=` argument. - Some test runs the parent with `subprocess.run(..., cwd=td)` where `td` is the tempdir. - Symptom order: early `ok` lines → `WinError 32 ... being used by another process: 'C:\\Users\\...\\Temp\\tmpXXXX'` naming the **directory**, not a file → suite aborts. - Red herring: the first tempdir you suspect (the one whose test polls for an output file) is not the holder. Adding `ignore_cleanup_errors=True` there changes nothing. ## Solution 1. **Find the holder by the fram