MCPcopy Create free account
hub / github.com/cloudflare/computer / waitForExit

Function waitForExit

packages/computerd/src/cli/computerd.test.ts:409–427  ·  view source on GitHub ↗
(child, timeoutMs = 2_000)

Source from the content-addressed store, hash-verified

407}
408
409async function waitForExit(child, timeoutMs = 2_000) {
410 let stderr = "";
411 child.stderr.setEncoding("utf8");
412 child.stderr.on("data", (chunk) => {
413 stderr += chunk;
414 });
415
416 return new Promise((resolve, reject) => {
417 const timeout = setTimeout(() => {
418 child.kill("SIGKILL");
419 reject(new Error("timed out waiting for computerd to exit"));
420 }, timeoutMs);
421
422 child.once("exit", (code, signal) => {
423 clearTimeout(timeout);
424 resolve({ code, signal, stderr });
425 });
426 });
427}
428
429async function waitForHTTPOK(url, child, output, timeoutMs = 5_000) {
430 const started = Date.now();

Callers 1

computerd.test.tsFile · 0.70

Calls 1

killMethod · 0.65

Tested by

no test coverage detected