MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / getDescendants

Function getDescendants

packages/cli/src/utils/orphanCleanup.ts:68–86  ·  view source on GitHub ↗
(pid: number)

Source from the content-addressed store, hash-verified

66}
67
68function getDescendants(pid: number): number[] {
69 let children: number[];
70 try {
71 const raw = execSync(`pgrep -P ${pid}`, { encoding: "utf-8", timeout: 2000 }).trim();
72 if (!raw) return [];
73 children = raw
74 .split("\n")
75 .map((s) => parseInt(s, 10))
76 .filter((n) => !isNaN(n) && n > 0);
77 } catch {
78 return [];
79 }
80 const all: number[] = [];
81 for (const child of children) {
82 all.push(child);
83 all.push(...getDescendants(child));
84 }
85 return all;
86}
87
88function killOrphansByName(processName: string): number {
89 const uid = getUid();

Callers 1

killProcessTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected