← Commit history

Merge PR #345: kicad-lane: battery never overlaps another bridge's battery on one box (#112)

Colby Knox ·54f5848488 ·12d ago ·parent 225dd8c
1 file changed +18
skills/kicad-bridge-test/run_verb_tests.py+18
@@ -572,6 +572,24 @@ def main():             ago = now - float(r.get("finishedAt") or 0)             if r.get("caller") not in IGNORE_CALLERS and r.get("verb") not in READ_ONLY and 0 <= ago <= 120:                 busy.append((r.get("caller"), r.get("verb"), round(ago, 1)))+        # another bridge's battery on the same box (altium-lane's, fusion-lane's), started from this machine: KiCad+        # windows rising during our run can take its clicks and keys (#112), so the two never overlap+        for pid in os.listdir("/proc") if os.path.isdir("/proc") else []:+            if not pid.isdigit() or int(pid) == os.getpid():+                continue+            try:+                argv = Path(f"/proc/{pid}/cmdline").read_bytes().split(b"\0")+            except OSError:+                continue+            args = [x.decode(errors="replace") for x in argv if x]+            if not args or "python" not in Path(args[0]).name:+                continue+            script = next((x for x in args if x.endswith("run_verb_tests.py")), "")+            if not script or "kicad-bridge-test" in script:+                continue+            tgt = next((args[i + 1] for i, x in enumerate(args[:-1]) if x == "--target"), "")+            if tgt == a.target:+                busy.append((f"another battery ({Path(script).parent.name}, pid {pid})", "run_verb_tests", 0.0))         return busy      waited = 0.0