MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / allocatePort

Function allocatePort

apps/local/src/serve.ts:123–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121const viteChildSignals = ["SIGINT", "SIGTERM", "SIGHUP"] as const;
122
123async function allocatePort(): Promise<number> {
124 const probe = Bun.serve({
125 port: 0,
126 hostname: "127.0.0.1",
127 fetch: () => new Response(),
128 });
129 const port = probe.port ?? 0;
130 probe.stop(true);
131 return port;
132}
133
134async function startViteChild(): Promise<ViteChild> {
135 const vitePort = await allocatePort();

Callers 1

startViteChildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected