fix: improve process termination handling for Windows

Updated the process termination logic in ClaudeUsageService to handle Windows environments correctly. The code now checks the operating system and calls the appropriate kill method, ensuring consistent behavior across platforms.
This commit is contained in:
Kacper
2026-01-16 20:27:53 +01:00
committed by Scott
parent 03516ac09e
commit d22deabe79

View File

@@ -277,9 +277,14 @@ export class ClaudeUsageService {
ptyProcess.write('\x1b'); // Send escape key
// Fallback: if ESC doesn't exit (Linux), use SIGTERM after 2s
// Windows doesn't support signals, so just call kill() without args
setTimeout(() => {
if (!settled && ptyProcess && !ptyProcess.killed) {
ptyProcess.kill('SIGTERM');
if (this.isWindows) {
ptyProcess.kill();
} else {
ptyProcess.kill('SIGTERM');
}
}
}, 2000);
}