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

Function waitForMarker

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

Source from the content-addressed store, hash-verified

387};
388
389const waitForMarker = async (
390 markerPath: string,
391 owned: OwnedChild,
392 timeoutMs: number,
393): Promise<ChildCloseResult> => {
394 const deadline = Date.now() + timeoutMs;
395 while (Date.now() < deadline) {
396 if (existsSync(markerPath)) {
397 return {
398 markerFound: true,
399 exitCode: owned.child.exitCode,
400 signalCode: owned.child.signalCode,
401 };
402 }
403 if (owned.child.exitCode !== null || owned.child.signalCode !== null) {
404 return {
405 markerFound: false,
406 exitCode: owned.child.exitCode,
407 signalCode: owned.child.signalCode,
408 };
409 }
410 await delay(25);
411 }
412 return { markerFound: false, exitCode: owned.child.exitCode, signalCode: owned.child.signalCode };
413};
414
415const waitForChildClose = async (owned: OwnedChild, timeoutMs: number): Promise<void> =>
416 new Promise((resolve) => {

Callers 1

Calls 1

delayFunction · 0.70

Tested by

no test coverage detected