MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / waitForChildClose

Function waitForChildClose

apps/local/src/db/owned-database.test.ts:415–430  ·  view source on GitHub ↗
(owned: OwnedChild, timeoutMs: number)

Source from the content-addressed store, hash-verified

413};
414
415const waitForChildClose = async (owned: OwnedChild, timeoutMs: number): Promise<void> =>
416 new Promise((resolve) => {
417 if (owned.child.exitCode !== null || owned.child.signalCode !== null) {
418 resolve();
419 return;
420 }
421 const timer = setTimeout(() => {
422 owned.child.off("close", onClose);
423 resolve();
424 }, timeoutMs);
425 const onClose = () => {
426 clearTimeout(timer);
427 resolve();
428 };
429 owned.child.once("close", onClose);
430 });

Callers 1

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected