Create a ProcessManager.
The supervisor options.
Restart the child: terminate the current one, wait for it to actually exit (so the port is released), then spawn a fresh one. No-op once stopped.
Start the child process (first launch). No-op once stopped.
Stop the supervisor permanently and terminate the child.
StaticcreateCreate a ProcessManager.
The supervisor options.
A new ProcessManager.
Supervises a single long-running child process for the dev server.
A naive
kill(); spawn()restart races on the listening port (the old process has not yet released it → intermittentEADDRINUSE). This manager makes restarts deterministic: it sendsSIGTERM, waits for the child'sexitevent (force-killing withSIGKILLafter a timeout), and only then spawns the replacement. It also owns a single set ofSIGINT/SIGTERMhandlers soCtrl+Calways tears the child down instead of leaving an orphan.