Skip to main content

Module process_list

Module process_list 

Source
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:

  1. Drop PID 0 and the excluded PID (the caller’s process by default).
  2. Merge entries with the same PID (active output wins if any entry is active).
  3. Ensure the display name is non-empty (reported name → executable name → bundle ID → pid <N>).
  4. 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.