MCPcopy Create free account
hub / github.com/tiann/hapi / waitForProcessDeath

Function waitForProcessDeath

cli/src/runner/controlClient.ts:312–322  ·  view source on GitHub ↗
(pid: number, timeout: number)

Source from the content-addressed store, hash-verified

310}
311
312async function waitForProcessDeath(pid: number, timeout: number): Promise<void> {
313 const start = Date.now();
314 while (Date.now() - start < timeout) {
315 if (isProcessAlive(pid)) {
316 await new Promise(resolve => setTimeout(resolve, 100));
317 continue;
318 }
319 return; // Process is dead
320 }
321 throw new Error('Process did not die within timeout');
322}

Callers 1

stopRunnerFunction · 0.85

Calls 1

isProcessAliveFunction · 0.90

Tested by

no test coverage detected