MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / allocateFreePort

Function allocateFreePort

apps/kimi-code/test/cli/server/server.test.ts:594–600  ·  view source on GitHub ↗
(host = '127.0.0.1')

Source from the content-addressed store, hash-verified

592}
593
594async function allocateFreePort(host = '127.0.0.1'): Promise<number> {
595 const server = await listenOnce(host, 0);
596 const address = server.address();
597 const port = typeof address === 'object' && address !== null ? address.port : 0;
598 await closeServer(server);
599 return port;
600}
601
602/**
603 * Find the start of a run of `count` consecutive free ports

Callers 2

allocateAdjacentFreeRunFunction · 0.85
server.test.tsFile · 0.85

Calls 2

listenOnceFunction · 0.85
closeServerFunction · 0.70

Tested by

no test coverage detected