ComfyUI Restart
Restart ComfyUI from the graph, without losing your launch flags
- status
- message
- restart_command
Every time you install a custom node or change a config, the ritual is: close ComfyUI, reopen it, and hope you remember your --port, --cors, and whatever else you launched it with. HMT_ComfyUIRestart turns that into a node. You queue it, and the server restarts itself - preserving its Python executable, working directory, and every command-line argument from the original launch.
Where this shines is chained after an install step: Custom Node Installer → ComfyUI Restart, and the whole thing runs unattended. It's from the HMT Suite pack (tuyenhm68), same install as the pack's other utilities.
How it works
The mechanism is pleasantly direct. When the node runs, it grabs sys.executable and sys.argv - the exact command that started this ComfyUI - and builds the restart command from them. If you've confirmed, it flushes output, waits your delay, then calls os.execv() to replace the current process with a fresh one using those same arguments. On the odd system where execv refuses (some launchers), it falls back to spawning a subprocess with the same command and exiting. Either way, your flags survive.
Because it doesn't shell out to a script, it works on Windows portable, Linux, and macOS without caring what launched you.
Inputs
restart_delay- seconds before the kill, 0–10, default 2. Give yourself a beat to read the log.confirm_restart- the one that matters. Defaultfalse, and nothing restarts until you flip it to true. This is the safety latch; running the node with it off just logs your restart command and returnscancelled.show_info(optional) - prints the Python path, working directory, and full argument list to the console. Turn it on the first time so you can see exactly what's being preserved.
Outputs
Three strings: status (success, cancelled, or error), message, and restart_command - the full command it would (or did) run. The last one is genuinely useful as a dry-run: set confirm_restart to false, run it, and copy the command it prints if you ever need to relaunch by hand.
Install
Standard HMT Suite setup:
cd ComfyUI/custom_nodes
git clone https://github.com/tuyenhm68/ComfyUI-HMT-Suite.git
cd ComfyUI-HMT-Suite
pip install -r requirements.txt
Restart (once, manually), then find it under HMT Suite > Utils > ComfyUI Restart.
Where people get burned
The restart is a real restart. When it fires, the browser's WebSocket connection drops and any in-progress generation is cancelled - and the node's own return value never actually reaches you, because the process is gone before it can. Two habits make this painless:
- Save your workflow before queueing it. Unsaved editor state is gone when the server bounces. This is the one that bites.
- Don't expect a clean completion. A restart that "fails" usually means the process died and didn't come back - check the terminal where you launched ComfyUI. On Windows portable, if the embedded Python is involved, relaunch from the same launcher you used originally, because
execvreplaces the process rather than going through your.bat.
It's a utility node, not a workhorse - you'll use it a few times, not every run. But the day you chain it after an installer and walk away, it feels like actual automation.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| restart_delay | INT | 20–10 | — |
| confirm_restart | BOOLEAN | false | — |
| show_infoopt | BOOLEAN | true | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| status | STRING | — |
| message | STRING | — |
| restart_command | STRING | — |