From d96a11a1c7cae82a30d8e88cd25ecae33b1359fa Mon Sep 17 00:00:00 2001 From: Priyanshu Choudhary <57816400+Priyanchew@users.noreply.github.com> Date: Wed, 8 Apr 2026 16:51:21 +0530 Subject: [PATCH] fix(cli): prevent double SIGTERM dispatch when both SIGINT and SIGTERM arrive The forward handler now self-removes both listeners before calling killProcessTree, so a second signal cannot invoke it again on an already-dead PID. Co-Authored-By: Claude Sonnet 4.6 --- packages/cli/src/commands/start.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 3364ff1ef..ba1ec693b 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -1148,6 +1148,8 @@ async function runStartup( // SIGINT/SIGTERM so the dashboard group is also cleaned up on exit. if (!isWindows() && pid) { const forward = (): void => { + process.off("SIGINT", forward); + process.off("SIGTERM", forward); void killProcessTree(pid, "SIGTERM"); }; process.once("SIGINT", forward);