mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Fix: Make cleanup strategy dynamic to support testing mocks
This commit is contained in:
@@ -137,7 +137,7 @@ const posixStrategy: ProcessCleanupStrategy = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const cleanupStrategy =
|
const getCleanupStrategy = () =>
|
||||||
os.platform() === 'win32' ? windowsStrategy : posixStrategy;
|
os.platform() === 'win32' ? windowsStrategy : posixStrategy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,17 +151,18 @@ export class ShellExecutionService {
|
|||||||
private static activeChildProcesses = new Set<number>();
|
private static activeChildProcesses = new Set<number>();
|
||||||
|
|
||||||
static cleanup() {
|
static cleanup() {
|
||||||
|
const strategy = getCleanupStrategy();
|
||||||
// Cleanup PTYs
|
// Cleanup PTYs
|
||||||
for (const [pid, pty] of this.activePtys) {
|
for (const [pid, pty] of this.activePtys) {
|
||||||
try {
|
try {
|
||||||
cleanupStrategy.killPty(pid, pty);
|
strategy.killPty(pid, pty);
|
||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup child processes
|
// Cleanup child processes
|
||||||
cleanupStrategy.killChildProcesses(this.activeChildProcesses);
|
strategy.killChildProcesses(this.activeChildProcesses);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
Reference in New Issue
Block a user