Process Manager

Phase 1 — Process listing (view)

  • Implement process.py view to enumerate all running processes
  • Display: PID, name, executable path (best-effort), command line
  • Cross-platform via psutil (fallbacks if some fields missing)
  • Tabular console output with wide-column truncation

Functional result: Running process.py view prints a table of all processes with PID, Name, Path (and cmdline where available).


Phase 2 — Start/Stop

  • process.py run <path> [args…] starts a new process (non-blocking) and prints its PID
  • process.py kill <PID> terminates the target process (use graceful terminate, then kill if needed)
  • Return exit codes reflecting success/failure
  • Optional working directory parameter (e.g., --cwd)

Functional result: A program can be launched and its new PID shown; kill stops the specified PID and reports success.


Phase 3 — Suspend/Resume

  • process.py suspend <PID> pauses the process (psutil suspend or POSIX SIGSTOP)
  • process.py resume <PID> resumes the process (psutil resume or POSIX SIGCONT)
  • Validate that the target PID exists and is not already in the requested state
  • Print short confirmations

Functional result: Suspending a PID halts it; resuming continues it; repeated commands are ignored with a brief notice.


Phase 4 — Live metrics & CLI

  • Extend view to include CPU% and memory usage (RSS/MB); compute CPU% with a short sampling window
  • Sorting options: --sort cpu|mem|pid and --desc
  • Minimal errors only: concise message for “PID not found” or “insufficient permission”
  • Implement argparse subcommands (including a helpful -h)

Functional result: process.py view --sort cpu --desc shows processes ordered by current CPU%; invalid PIDs yield a short, clear message while valid operations succeed.