all: use named pipes on windows

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-11-21 09:00:20 -08:00
committed by Maisem Ali
parent 45042a76cd
commit adc302f428
12 changed files with 159 additions and 82 deletions

View File

@@ -7,6 +7,7 @@ package safesocket
import (
"fmt"
"path/filepath"
"runtime"
"testing"
)
@@ -14,7 +15,12 @@ func TestBasics(t *testing.T) {
// Make the socket in a temp dir rather than the cwd
// so that the test can be run from a mounted filesystem (#2367).
dir := t.TempDir()
sock := filepath.Join(dir, "test")
var sock string
if runtime.GOOS != "windows" {
sock = filepath.Join(dir, "test")
} else {
sock = fmt.Sprintf(`\\.\pipe\tailscale-test`)
}
l, port, err := Listen(sock, 0)
if err != nil {