MCPcopy Create free account
hub / github.com/auth0/auth0-cli / isPortFree

Function isPortFree

internal/cli/acul_dev.go:256–266  ·  view source on GitHub ↗

isPortFree returns true if port is free (no TCP connection possible).

(port string)

Source from the content-addressed store, hash-verified

254
255// isPortFree returns true if port is free (no TCP connection possible).
256func isPortFree(port string) bool {
257 addr := net.JoinHostPort("127.0.0.1", port)
258 conn, err := net.DialTimeout("tcp", addr, 250*time.Millisecond)
259 if err != nil {
260 return true
261 }
262
263 conn.Close()
264 // Dial succeeded -> something is listening -> not free.
265 return false
266}
267
268func runConnectedMode(ctx context.Context, cli *cli, projectDir, port string, screensToWatch []string) error {
269 fmt.Println("\n🚀 " + ansi.Green("ACUL connected dev mode started for: "+ansi.Cyan(projectDir)))

Callers 2

runNormalModeFunction · 0.85
runConnectedModeFunction · 0.85

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected