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

Function readLinuxChildrenFromProc

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

Source from the content-addressed store, hash-verified

179}
180
181function readLinuxChildrenFromProc(pid: number): number[] | null {
182 try {
183 const childrenPath = `/proc/${pid}/task/${pid}/children`;
184 const output = fs.readFileSync(childrenPath, { encoding: "utf-8" });
185 return String(output)
186 .split(/\s+/)
187 .map((item) => Number(item.trim()))
188 .filter((item) => Number.isInteger(item) && item > 0);
189 } catch (error) {
190 return null;
191 }
192}

Callers 1

listLinuxChildPidsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected