pub fn scan(claude_pid: u32, extra_commands: &[String]) -> ProcessSnapshotExpand description
Walk claude_pid’s descendant tree plus any command-matched
backgrounded local_bash and build a sorted snapshot. Always
returns successfully - sysinfo failures, missing processes, or empty
trees all collapse to an empty snapshot with a fresh scanned_at.
extra_commands are the session’s live backgrounded local_bash
commands: such a bash is setsid-detached (or orphaned to init when
its session’s claude exits) so it sits outside claude’s tree, and
adopting the command-matched wrapper plus its subtree gives it a real
RAM + process-tree row instead of a memory-less synthetic one.
Filters applied to every candidate: skip the scanner’s own pid,
zombies/dead (in the table but no live work), and the one-shot ps /
sysinfo self-probes that would themselves match the walk window.