Answer principles round 1: 1 🔴, 7 🟡 (0 misread); every effect is handed in as an argument, no test patches a global, and the traces principle scopes tools that run on their user's machine
CI / tests (pull_request) Successful in 3m43s

This commit is contained in:
2026-11-19 12:42:03 +01:00
parent 8ca612b7a4
commit cb3135bc8c
124 changed files with 1437 additions and 793 deletions
+4 -5
View File
@@ -7,8 +7,8 @@ import os
import pathlib
import signal
import stat
import typing
from machine_load.slots import slot_folder
# The command names of a shell claude starts for a Bash call.
SHELL_NAMES = frozenset({"bash", "dash", "sh", "zsh"})
@@ -149,15 +149,14 @@ def holds_slot(pid: int, slots: pathlib.Path) -> bool:
return any(has_slot(each, slots) for each in descendants(pid))
def shells_of(claude_pid: int) -> list[Shell]:
"""The shells that are children of claude_pid; none where /proc doesn't exist, as off Linux."""
def shells_of(claude_pid: int, slots: pathlib.Path, children: typing.Callable[[int], list[int]]) -> list[Shell]:
"""The shells that are children of claude_pid, which children lists as children_of does, each knowing whether it holds a heavy slot in the folder slots; none where /proc doesn't exist, as off Linux."""
if not os.path.isdir("/proc"):
return []
slots = slot_folder(os.environ, pathlib.Path.home())
booted = boot_time()
ticks = os.sysconf("SC_CLK_TCK")
shells = []
for pid in children_of(claude_pid):
for pid in children(claude_pid):
found = parent_and_start(pid)
if found is None or found[2] not in SHELL_NAMES:
continue