From e44d4ace72cb1f7b9dfc6c5bd0957d8f96bfd56f Mon Sep 17 00:00:00 2001 From: Fernando Celmer Date: Sat, 15 Aug 2026 13:47:33 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=B2=20BUG-#19:=20Guard=20exit/spawnErr?= =?UTF-8?q?or=20handlers=20against=20a=20stale=20client=20clobbering=20the?= =?UTF-8?q?=20active=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/chat/chat.controller.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/features/chat/chat.controller.ts b/src/features/chat/chat.controller.ts index 4a61990..4723aff 100644 --- a/src/features/chat/chat.controller.ts +++ b/src/features/chat/chat.controller.ts @@ -175,10 +175,16 @@ export class ChatController { this.post({ type: "stderr", text }); }); client.on("exit", ({ code }: { code: number | null }) => { + if (this.client !== client) { + return; + } this.post({ type: "processExit", code }); this.client = undefined; }); client.on("spawnError", (error: NodeJS.ErrnoException) => { + if (this.client !== client) { + return; + } if (error.code === "ENOENT") { this.post({ type: "cliMissing", command }); } else {