feat: add support for agentsock on Windows (#22171)

relates to #21335

Adds support for the agentsock and thus `coder exp sync` commands on Windows. This support was initially missing.
This commit is contained in:
Spike Curtis
2026-02-20 16:27:32 +04:00
committed by GitHub
parent 9bbe3c6af9
commit 1069ce6e19
6 changed files with 80 additions and 134 deletions
+10
View File
@@ -1,7 +1,10 @@
package testutil
import (
"crypto/rand"
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"testing"
@@ -37,3 +40,10 @@ func TempDirUnixSocket(t *testing.T) string {
})
return dir
}
func AgentSocketPath(t *testing.T) string {
if runtime.GOOS == "windows" {
return fmt.Sprintf(`\\.\pipe\com.coder.agentsocket_test.%s.%s`, t.Name(), rand.Text())
}
return filepath.Join(TempDirUnixSocket(t), "test.sock")
}