MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / killChild

Function killChild

packages/agent-core/src/services/fs/fsGitService.ts:273–293  ·  view source on GitHub ↗
(child: ChildProcess)

Source from the content-addressed store, hash-verified

271}
272
273function killChild(child: ChildProcess): void {
274 // On Windows, `ChildProcess.kill()` only signals the direct child (e.g. the
275 // `cmd.exe` wrapper when `shell` is involved, or the `git`/`gh` parent),
276 // leaving grandchildren alive and holding the cwd. Terminate the whole
277 // process tree so the working directory is released promptly.
278 if (process.platform === 'win32' && child.pid !== undefined) {
279 try {
280 const killer = spawn('taskkill', ['/T', '/F', '/PID', String(child.pid)], {
281 stdio: 'ignore',
282 windowsHide: true,
283 });
284 killer.once('error', () => {});
285 return;
286 } catch {
287 // fall through to the direct kill below
288 }
289 }
290 try {
291 child.kill();
292 } catch {}
293}
294
295function parsePullRequest(stdout: string): FsPullRequest | null {
296 let raw: unknown;

Callers 1

runCommandFunction · 0.85

Calls 3

onceMethod · 0.65
killMethod · 0.65
spawnFunction · 0.50

Tested by

no test coverage detected