Skip to main content

Module process

Module process 

Source

Functions§

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.
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).