MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / listLinuxChildPids

Function listLinuxChildPids

common/src/process_tools.ts:166–179  ·  view source on GitHub ↗
(pid: number)

Source from the content-addressed store, hash-verified

164}
165
166function listLinuxChildPids(pid: number): number[] {
167 const procChildren = readLinuxChildrenFromProc(pid);
168 if (procChildren) return procChildren;
169
170 try {
171 const output = execSync(`ps -o pid= --ppid ${pid}`, { encoding: "utf-8" });
172 return String(output)
173 .split(/\s+/)
174 .map((item) => Number(item.trim()))
175 .filter((item) => Number.isInteger(item) && item > 0);
176 } catch (error) {
177 return [];
178 }
179}
180
181function readLinuxChildrenFromProc(pid: number): number[] | null {
182 try {

Callers 1

collectLinuxChildPidsFunction · 0.85

Calls 1

Tested by

no test coverage detected