MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / waitForPort

Function waitForPort

ts/workflow-cli/cli/open.ts:147–160  ·  view source on GitHub ↗
(port: number, timeoutMs: number)

Source from the content-addressed store, hash-verified

145}
146
147async function waitForPort(port: number, timeoutMs: number): Promise<boolean> {
148 const deadline = Date.now() + timeoutMs;
149 while (Date.now() < deadline) {
150 try {
151 const res = await fetch(`http://127.0.0.1:${port}/`, { method: "HEAD" });
152 // Any HTTP response means vite's listening.
153 if (res) return true;
154 } catch {
155 // Connection refused — keep waiting.
156 }
157 await new Promise((r) => setTimeout(r, 150));
158 }
159 return false;
160}
161
162function openInBrowser(url: string): void {
163 const platform = process.platform;

Callers 1

openDevFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected