From a60066df822df818bd0950afb0a9917a42b75bc8 Mon Sep 17 00:00:00 2001 From: Felix Berlakovich Date: Tue, 13 Jan 2026 11:12:43 +0100 Subject: [PATCH] fix: forward signals to child process in binary launcher --- scripts/claude_version_utils.cjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/claude_version_utils.cjs b/scripts/claude_version_utils.cjs index 2184917a..1a6b6380 100644 --- a/scripts/claude_version_utils.cjs +++ b/scripts/claude_version_utils.cjs @@ -497,6 +497,18 @@ function runClaudeCli(cliPath) { stdio: 'inherit', env: process.env }); + + // Forward signals to child process so it gets killed when parent is killed + // This prevents orphaned Claude processes when switching between local/remote modes + const forwardSignal = (signal) => { + if (child.pid && !child.killed) { + child.kill(signal); + } + }; + process.on('SIGTERM', () => forwardSignal('SIGTERM')); + process.on('SIGINT', () => forwardSignal('SIGINT')); + process.on('SIGHUP', () => forwardSignal('SIGHUP')); + child.on('exit', (code) => { process.exit(code || 0); });