Unclaimed files left in the canonical checkout. Inventory: canonical-cleanup-inventory.md (commit-as-evidence groups). detect-secrets scan clean on 2026-11-02: hits are sha256 pins, git object ids, test sentinels already in tracked tests and unit-file lines.
21 lines
805 B
Python
21 lines
805 B
Python
from pathlib import Path
|
|
import os, re, sys
|
|
own = {os.getpid()}
|
|
pid = os.getppid()
|
|
while pid > 1 and pid not in own:
|
|
own.add(pid)
|
|
try: pid = int((Path('/proc') / str(pid) / 'stat').read_text().split(') ', 1)[1].split()[1])
|
|
except (OSError, ValueError, IndexError): break
|
|
busy = []
|
|
for p in Path('/proc').glob('[0-9]*'):
|
|
if int(p.name) in own: continue
|
|
try:
|
|
args = (p / 'cmdline').read_bytes().split(b'\0')
|
|
cmd = b' '.join(args).decode(errors='replace')
|
|
if any(x in cmd for x in ['shell-snapshots','chrome-devtools-mcp','busy.py','sage-busy-now']): continue
|
|
if re.search(r'node --test|gate\.sh|mutants?\.py|scripts/test-[a-z-]+\.sh|docker compose', cmd):
|
|
busy.append(int(p.name))
|
|
except OSError: pass
|
|
print('BUSY pids=' + ','.join(map(str,busy)) if busy else 'CLEAR')
|
|
sys.exit(bool(busy))
|