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
process_alive— “is pidstill around?” find_processes_by_cmdline—pgrep -f <pattern>equivalentkill_process— SIGTERM / SIGKILL equivalent (taskkill /T on Windows so the tree dies, not just the parent)
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 containspattern. 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_alivefor that).force=trueis SIGKILL /taskkill /F;force=falseis SIGTERM /taskkill(graceful). - parse_
session_ arg - Parse
--session <name>from a wire daemon command line. ReturnsNoneif 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
Noneif the pid is missing / unreadable / exited between query and answer. - process_
alive - True iff pid is alive.