INNER CODE UNIT · TypeScript
endPort
kubernetes-sigs/headlamp · app/electron/main.ts:824
const endPort = defaultPort + MAX_PORT_ATTEMPTS - 1;
for (let port = startPort; port <= endPort; port++) {
// Probe the socket first so normal startup does not load and retain the
// process-inspection dependency when the preferred port is free.
const available = await isPortAvailable(port);
if (available) {
if (port !== startPort) {
console.info(`Port ${startPort} is in use, using port ${port} instead`);
}
return port;
}
console.info(`Port ${port} is occupied, trying next port...`);
}
throw new BackendPortAllocationError(
`Could not find an available port after ${MAX_PORT_ATTEMPTS} attempts starting from ${startPort}`