MCPcopy Index your code
hub / github.com/anomalyco/opencode / startWithPortFallback

Function startWithPortFallback

packages/opencode/src/server/server.ts:117–122  ·  view source on GitHub ↗
(opts: ListenOptions)

Source from the content-addressed store, hash-verified

115}
116
117function startWithPortFallback(opts: ListenOptions) {
118 if (opts.port !== 0) return startListener(opts, opts.port)
119 // Match the legacy listener port-resolution behavior: explicit `0` prefers
120 // 4096 first, then any free port.
121 return startListener(opts, 4096).pipe(Effect.catch(() => startListener(opts, 0)))
122}
123
124function startListener(opts: ListenOptions, port: number) {
125 const scope = Scope.makeUnsafe()

Callers 1

server.tsFile · 0.85

Calls 1

startListenerFunction · 0.70

Tested by

no test coverage detected