fix(coding-agent): kill tracked detached bash children on shutdown
This commit is contained in:
@@ -172,6 +172,27 @@ export function sanitizeBinaryOutput(str: string): string {
|
||||
.join("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Detached child processes must be tracked so they can be killed on parent
|
||||
* shutdown signals (SIGHUP/SIGTERM).
|
||||
*/
|
||||
const trackedDetachedChildPids = new Set<number>();
|
||||
|
||||
export function trackDetachedChildPid(pid: number): void {
|
||||
trackedDetachedChildPids.add(pid);
|
||||
}
|
||||
|
||||
export function untrackDetachedChildPid(pid: number): void {
|
||||
trackedDetachedChildPids.delete(pid);
|
||||
}
|
||||
|
||||
export function killTrackedDetachedChildren(): void {
|
||||
for (const pid of trackedDetachedChildPids) {
|
||||
killProcessTree(pid);
|
||||
}
|
||||
trackedDetachedChildPids.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Kill a process and all its children (cross-platform)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user