MCPcopy Create free account
hub / github.com/anomalyco/opencode / isPortInUse

Function isPortInUse

packages/opencode/src/mcp/oauth-callback.ts:163–174  ·  view source on GitHub ↗
(port: number = OAUTH_CALLBACK_PORT)

Source from the content-addressed store, hash-verified

161}
162
163export async function isPortInUse(port: number = OAUTH_CALLBACK_PORT): Promise<boolean> {
164 return new Promise((resolve) => {
165 const socket = createConnection(port, "127.0.0.1")
166 socket.on("connect", () => {
167 socket.destroy()
168 resolve(true)
169 })
170 socket.on("error", () => {
171 resolve(false)
172 })
173 })
174}
175
176export async function stop(): Promise<void> {
177 if (server) {

Callers 1

ensureRunningFunction · 0.85

Calls 3

onMethod · 0.80
destroyMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected