Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions scripts/claude_version_utils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down