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

Function allocatePort

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

Source from the content-addressed store, hash-verified

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

Callers 1

startViteChildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected