MCPcopy Index your code
hub / github.com/coder/coder / isPortBusy

Function isPortBusy

scripts/develop/main.go:1431–1439  ·  view source on GitHub ↗
(ctx context.Context, port int64)

Source from the content-addressed store, hash-verified

1429}
1430
1431func isPortBusy(ctx context.Context, port int64) bool {
1432 d := net.Dialer{Timeout: 2 * time.Second}
1433 conn, err := d.DialContext(ctx, "tcp", fmt.Sprintf("127.0.0.1:%d", port))
1434 if err != nil {
1435 return false
1436 }
1437 _ = conn.Close()
1438 return true
1439}
1440
1441func isCoderRunning(ctx context.Context, baseURL string) bool {
1442 ctx, cancel := context.WithTimeout(ctx, 2*time.Second)

Callers 2

preflightFunction · 0.85
startPrometheusServerFunction · 0.85

Calls 2

DialContextMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected