Snakepit.ProcessKiller (Snakepit v0.8.7)
View SourceRobust OS process management using Erlang primitives. No shell commands, pure Erlang/Elixir.
This module provides POSIX-compliant process management that works across Linux, macOS, and BSD systems without relying on shell-specific features like pkill.
Summary
Functions
Finds all Python processes on the system. Returns a list of OS PIDs.
Gets the command line of a process. POSIX-compliant using /proc on Linux, ps on macOS/BSD.
Gets the process group ID (PGID) for a process.
Kills all processes matching a run ID. Pure Erlang implementation, no pkill.
Kills a process by PID using proper Erlang signals.
Kills a process group by PGID using proper Erlang signals.
Kills a process group with escalation: SIGTERM -> wait -> SIGKILL.
Kills a process with escalation: SIGTERM -> wait -> SIGKILL
Checks if a process is alive. Uses kill -0 (signal 0) which doesn't kill but checks existence.
Returns true if the platform supports process group kill semantics.
Returns the path to the setsid executable, or {:error, :not_found}.
Returns the setsid executable path or raises if not available.
Functions
Finds all Python processes on the system. Returns a list of OS PIDs.
Gets the command line of a process. POSIX-compliant using /proc on Linux, ps on macOS/BSD.
Gets the process group ID (PGID) for a process.
Kills all processes matching a run ID. Pure Erlang implementation, no pkill.
Kills a process by PID using proper Erlang signals.
Parameters
os_pid: OS process ID (integer)signal: :sigterm | :sigkill | :sighup
Returns
:okif kill succeeded{:error, reason}if kill failed
Kills a process group by PGID using proper Erlang signals.
Parameters
pgid: Process group ID (integer)signal: :sigterm | :sigkill | :sighup
Kills a process group with escalation: SIGTERM -> wait -> SIGKILL.
Kills a process with escalation: SIGTERM -> wait -> SIGKILL
Checks if a process is alive. Uses kill -0 (signal 0) which doesn't kill but checks existence.
Returns true if the platform supports process group kill semantics.
Returns the path to the setsid executable, or {:error, :not_found}.
Returns the setsid executable path or raises if not available.