Skip to main content Module process Copy item path Source find_killable_pids Returns PIDs that are NOT MCP stdio servers (safe to kill during lean-ctx stop).
MCP servers are child processes of the IDE and must not be killed — the IDE
will immediately respawn them, causing a kill loop that requires a reboot. find_pids_by_name Find all PIDs of processes whose executable name matches name.
Excludes the current process. force_kill Unconditionally kill a process. is_alive Check whether a process with the given PID is still running. kill_all_by_name Kill non-MCP processes matching name (SIGTERM then SIGKILL).
Returns count of killed processes. run_with_timeout Run a command with a hard timeout, capturing its output. spawn_detached Spawn a long-lived background process (proxy, daemon) detached from the
current process so it survives the parent’s exit. terminate_gracefully Ask a process to terminate gracefully (SIGTERM on Unix, nothing on Windows
since we prefer HTTP shutdown; the caller should have already tried that).