Skip to main content

Module platform

Module platform 

Source
Expand description

Cross-platform process-management primitives.

Wire historically called pgrep + kill directly, which gave us “unsupported platform” rot on Windows. v0.7.3 funnels every liveness check / command-line search / SIGTERM through this module so the Windows daemon + relay paths get the same teardown + respawn behavior the Linux + macOS paths have always had.

§Helpers

Each helper returns conservative defaults on tool failure (empty Vec, false) so callers can chain them without aborting an upgrade mid-flight when one query hiccups.

Functions§

find_processes_by_cmdline
pgrep -f <pattern> equivalent: every pid whose command line contains pattern. Empty Vec on tool error or zero matches.
kill_process
Signal a pid to exit. Returns true on successful dispatch (NOT on confirmed exit — poll process_alive for that). force=true is SIGKILL / taskkill /F; force=false is SIGTERM / taskkill (graceful).
parse_session_arg
Parse --session <name> from a wire daemon command line. Returns None if not present. v0.14.2 (#170 supervisor pairs a --session <name> arg with the WIRE_HOME the daemon serves; this extracts it for orphan-pid diagnostic display).
pid_cmdline
Return the command line of a specific pid, or None if the pid is missing / unreadable / exited between query and answer.
process_alive
True iff pid is alive.