Centralize Claude SDK launch path
This commit is contained in:
@@ -897,12 +897,20 @@ export async function createTerminal(options: CreateTerminalOptions): Promise<Te
|
||||
function kill(): void {
|
||||
if (!killed) {
|
||||
killed = true;
|
||||
ptyProcess.kill();
|
||||
killPtyProcess();
|
||||
emitExit(buildExitInfo());
|
||||
}
|
||||
disposeResources();
|
||||
}
|
||||
|
||||
function killPtyProcess(signal?: NodeJS.Signals): void {
|
||||
if (process.platform === "win32") {
|
||||
ptyProcess.kill();
|
||||
return;
|
||||
}
|
||||
ptyProcess.kill(signal);
|
||||
}
|
||||
|
||||
function waitForProcessExit(timeoutMs: number): Promise<boolean> {
|
||||
if (processExited) {
|
||||
return Promise.resolve(true);
|
||||
@@ -940,7 +948,7 @@ export async function createTerminal(options: CreateTerminalOptions): Promise<Te
|
||||
}
|
||||
|
||||
try {
|
||||
ptyProcess.kill();
|
||||
killPtyProcess();
|
||||
} catch {
|
||||
// process may already be gone
|
||||
}
|
||||
@@ -948,7 +956,7 @@ export async function createTerminal(options: CreateTerminalOptions): Promise<Te
|
||||
const exitedGracefully = await waitForProcessExit(gracefulTimeoutMs);
|
||||
if (!exitedGracefully) {
|
||||
try {
|
||||
ptyProcess.kill("SIGKILL");
|
||||
killPtyProcess("SIGKILL");
|
||||
} catch {
|
||||
// process may already be gone
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user