MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / openBrowserWhenReady

Function openBrowserWhenReady

packages/setupWizard/src/index.ts:69–83  ·  view source on GitHub ↗
(url: string, timeoutMs = 120_000)

Source from the content-addressed store, hash-verified

67}
68
69async function openBrowserWhenReady(url: string, timeoutMs = 120_000): Promise<void> {
70 const start = Date.now();
71 while (Date.now() - start < timeoutMs) {
72 try {
73 const res = await fetch(url, { signal: AbortSignal.timeout(2000) });
74 if (res.status < 500) {
75 openBrowser(url);
76 return;
77 }
78 } catch {
79 // not yet ready
80 }
81 await new Promise((r) => setTimeout(r, 2000));
82 }
83}
84
85// Parses the top-level `volumes:` block of a docker-compose.yml and returns the
86// declared volume names. Sufficient for our generated compose file; not a full

Callers 1

mainFunction · 0.85

Calls 1

openBrowserFunction · 0.85

Tested by

no test coverage detected