fix(proxy): clean up temp launch settings

This commit is contained in:
Tam Nhu Tran
2026-04-28 11:59:37 -04:00
parent 3dcf150978
commit 47fbe8bb3a
6 changed files with 93 additions and 15 deletions
+13 -1
View File
@@ -208,7 +208,8 @@ export function getWindowsEscapedCommandShell(): SpawnOptions['shell'] {
export function execClaude(
claudeCli: string,
args: string[],
envVars: NodeJS.ProcessEnv | null = null
envVars: NodeJS.ProcessEnv | null = null,
onExitCleanup?: () => void
): void {
const isWindows = process.platform === 'win32';
const isPowerShellScript = isWindows && /\.ps1$/i.test(claudeCli);
@@ -286,6 +287,17 @@ export function execClaude(
});
}
let cleanedUp = false;
const runExitCleanup = (): void => {
if (cleanedUp) {
return;
}
cleanedUp = true;
onExitCleanup?.();
};
child.once('exit', runExitCleanup);
child.once('error', runExitCleanup);
wireChildProcessSignals(child, async (err: NodeJS.ErrnoException) => {
if (err.code === 'EACCES') {
console.error(`[X] Claude CLI is not executable: ${claudeCli}`);