MCPcopy Index your code
hub / github.com/CapSoftware/Cap / waitForApp

Function waitForApp

apps/desktop/scripts/desktop-memory-soak.js:350–364  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

348}
349
350async function waitForApp(options) {
351 const deadline = Date.now() + options.launchTimeoutSeconds * 1000;
352
353 while (Date.now() < deadline) {
354 const app = findCapMainProcess(readProcesses(), options.appCommandPrefix);
355
356 if (app) return app;
357
358 await sleep(500);
359 }
360
361 throw new Error(
362 `Cap did not launch within ${options.launchTimeoutSeconds} seconds: ${options.appCommandPrefix}`,
363 );
364}
365
366async function waitForAppExit(child, timeoutSeconds) {
367 const deadline = Date.now() + timeoutSeconds * 1000;

Callers 1

mainFunction · 0.85

Calls 3

findCapMainProcessFunction · 0.90
readProcessesFunction · 0.85
sleepFunction · 0.70

Tested by

no test coverage detected