make metrics tests pass on windows

Signed-off-by: guillaume.tardif <guillaume.tardif@gmail.com>
This commit is contained in:
guillaume.tardif 2020-10-07 09:55:05 +02:00
parent 9ad06e55b5
commit 886363b44a
1 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@ package metrics
import (
"net"
"strings"
"time"
"github.com/Microsoft/go-winio"
@ -30,6 +31,9 @@ var (
)
func conn() (net.Conn, error) {
timeout := 200 * time.Millisecond
return winio.DialPipe(socket, &timeout)
if strings.HasPrefix(socket, `\\.\pipe\`) {
timeout := 200 * time.Millisecond
return winio.DialPipe(socket, &timeout)
}
return net.Dial("unix", socket)
}