Expand description
OS-independent post-processing for process enumeration results (ProcessInfo).
Each OS backend returns a raw list as found (a PID may appear in multiple sessions or nodes, and names may be empty). The facade passes it through here to normalize it across all OSes:
- Drop PID 0 and the excluded PID (the caller’s process by default).
- Merge entries with the same PID (active output wins if any entry is active).
- Ensure the display name is non-empty (reported name → executable name → bundle ID →
pid <N>). - Sort active entries first, then by display name (case-insensitive), then PID for stable results.
Functions§
- executable_
basename - Extract the executable basename from a path (
/and\are both separators). - normalize_
process_ list - Normalize the raw process list by merging duplicates, excluding PIDs, filling display names, and sorting.