(path string)
| 49 | } |
| 50 | |
| 51 | func isSocketAvailable(path string) bool { |
| 52 | if _, err := os.Stat(path); os.IsNotExist(err) { |
| 53 | return true |
| 54 | } |
| 55 | |
| 56 | // Try to connect to see if it's actually listening. |
| 57 | dialer := net.Dialer{Timeout: 10 * time.Second} |
| 58 | conn, err := dialer.Dial("unix", path) |
| 59 | if err != nil { |
| 60 | return true |
| 61 | } |
| 62 | _ = conn.Close() |
| 63 | return false |
| 64 | } |
| 65 | |
| 66 | func dialSocket(ctx context.Context, path string) (net.Conn, error) { |
| 67 | if path == "" { |
no test coverage detected