MCPcopy Create free account
hub / github.com/arctic-cli/interface / isPortInUse

Function isPortInUse

packages/arctic/src/mcp/oauth-callback.ts:164–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

162 }
163
164 export async function isPortInUse(): Promise<boolean> {
165 return new Promise((resolve) => {
166 Bun.connect({
167 hostname: "127.0.0.1",
168 port: OAUTH_CALLBACK_PORT,
169 socket: {
170 open(socket) {
171 socket.end()
172 resolve(true)
173 },
174 error() {
175 resolve(false)
176 },
177 data() {},
178 close() {},
179 },
180 }).catch(() => {
181 resolve(false)
182 })
183 })
184 }
185
186 export async function stop(): Promise<void> {
187 if (server) {

Callers 1

ensureRunningFunction · 0.85

Calls 2

resolveFunction · 0.85
connectMethod · 0.45

Tested by

no test coverage detected