MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getChildPids

Function getChildPids

source code/utils/genericProcessUtils.ts:165–186  ·  view source on GitHub ↗
(pid: string | number)

Source from the content-addressed store, hash-verified

163 * @returns Array of child process IDs as numbers
164 */
165export function getChildPids(pid: string | number): number[] {
166 try {
167 const pidStr = String(pid)
168 const command =
169 process.platform === 'win32'
170 ? `powershell.exe -NoProfile -Command "(Get-CimInstance Win32_Process -Filter \\"ParentProcessId=${pidStr}\\").ProcessId"`
171 : `pgrep -P ${pidStr}`
172
173 const result = execSyncWithDefaults_DEPRECATED(command, { timeout: 1000 })
174 if (!result) {
175 return []
176 }
177 return result
178 .trim()
179 .split('\n')
180 .filter(Boolean)
181 .map(p => parseInt(p, 10))
182 .filter(p => !isNaN(p))
183 } catch {
184 return []
185 }
186}

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected