MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / until

Function until

__tests__/mcp-stdout-failure.test.ts:53–59  ·  view source on GitHub ↗
(check: () => boolean, what: string, timeout = 20_000)

Source from the content-addressed store, hash-verified

51const delay = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms));
52
53async function until(check: () => boolean, what: string, timeout = 20_000): Promise<void> {
54 const deadline = Date.now() + timeout;
55 while (!check()) {
56 if (Date.now() > deadline) throw new Error(`Timed out waiting for ${what}`);
57 await delay(25);
58 }
59}
60
61/** Remove `dir` once nothing holds it: Windows can keep it busy a moment after a child exits. */
62async function removeWhenReleased(dir: string, timeoutMs = 5_000): Promise<void> {

Callers 1

Calls 2

checkFunction · 0.70
delayFunction · 0.70

Tested by

no test coverage detected