fix(process): restrict cleanup to captured group leaders

This commit is contained in:
N0zoM1z0
2026-07-14 21:16:57 +00:00
parent 2223da1916
commit 40c6f60ac9
4 changed files with 43 additions and 16 deletions
+2 -6
View File
@@ -285,7 +285,7 @@ export const releaseProcessResources = async (options: {
readonly checkpoints: ProcessCheckpoints | undefined;
readonly runId: string;
readonly temporaryRoot: string;
readonly sampledProcessGroupIds: readonly number[];
readonly capturedProcessGroupIds: readonly number[];
}): Promise<string | undefined> => {
for (const timer of options.timers) clearTimeout(timer);
let failure: string | undefined;
@@ -310,11 +310,7 @@ export const releaseProcessResources = async (options: {
failure ??= "filesystem checkpoint cleanup failed";
}
if (options.terminal !== undefined && process.platform !== "win32") {
const processGroupIds = new Set([
options.terminal.pid,
...options.sampledProcessGroupIds,
]);
for (const processGroupId of processGroupIds) {
for (const processGroupId of new Set(options.capturedProcessGroupIds)) {
const cleaned = await cleanupOwnedProcessGroup({
runId: options.runId,
leaderPid: processGroupId,