Kill Process by PID
The pack's one kill node that isn't limited to its own processes
- trigger
- trigger
- success
- status
Kill Process by PID is the outlier in the comfyui-sg-process-manager pack, and it's worth understanding why before you use it. The other kill nodes work on the pack's global key registry - they only touch processes this pack started. This one skips the registry entirely and goes straight at the operating system with a raw process ID. It will happily kill a process that ComfyUI never had anything to do with, which is exactly what you want in one situation and a hazard in every other one.
The obvious use: you started something with Start Process, grabbed its pid output, and now want to shut it down without juggling keys. Wire Start Process's pid straight into this node's pid input and you have a self-contained start→kill loop that doesn't care about key names at all.
How it works
Platform-specific under the hood, which is worth knowing:
- Windows: runs
taskkill /PID <pid>(with/Tto terminate the whole process tree when not force-killing, or/Fto force). A non-zero exit code comes back as failure with the error text from stderr. - Unix/macOS: calls
os.kill()directly -SIGTERMnormally,SIGKILLwhenforce_killis on. AProcessLookupError(nobody with that PID) comes back as "Process not found".
The pid=0 trap - read this
The pid input defaults to 0. On Unix, os.kill(0, SIGTERM) doesn't mean "kill nothing" - it means send the signal to every process in the current process group, which includes ComfyUI itself. Queue this node without setting a real PID and you can take down your whole session. Set the pid. Always. (On Windows, taskkill /PID 0 just errors out and returns failure, so the hazard is Unix-specific, but "always set a real pid" is a good habit everywhere.)
Inputs and outputs otherwise follow the pack's pattern: trigger (any type, passthrough), force_kill (BOOLEAN, default False), and outputs trigger, success (BOOLEAN), and status (STRING - "Process killed successfully" or the failure reason).
Install
ComfyUI Manager, search "comfyui-sg-process-manager", or:
cd ComfyUI/custom_nodes
git clone https://github.com/sebagallo/comfyui-sg-process-manager.git
Restart ComfyUI. No dependencies, no model files.
When to use it (and when not to)
Use it when you have a specific PID and you're sure it's the process you want dead. Don't use it as a lazy "cleanup everything" button - that's what Kill All Processes is for. And because it reaches outside the pack's registry, a typo in a PID can kill something you actually needed. Double-check, set the pid, and keep the force-kill default off so the process gets a chance to clean up.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| trigger | * | — | |
| pid | INT | 0 | — |
| force_killopt | BOOLEAN | false | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| trigger | * | — |
| success | BOOLEAN | — |
| status | STRING | — |