mirror of
https://github.com/wavetermdev/waveterm
synced 2026-04-21 22:47:16 +00:00
#2643 ## Implementation 1. Add platform-aware identity-agent dialing: on Window, default to `//./pipe/openssh-ssh-agent`. 2. Keep Unix agent dialing via Unix sockets; unify agent resolution across platforms. 3. Add cross-platform unit tests covering dialer selection and failure paths.
35 lines
585 B
Go
35 lines
585 B
Go
//go:build !windows
|
|
|
|
package remote
|
|
|
|
import (
|
|
"net"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestDialIdentityAgentUnix(t *testing.T) {
|
|
socketPath := filepath.Join(t.TempDir(), "agent.sock")
|
|
|
|
ln, err := net.Listen("unix", socketPath)
|
|
if err != nil {
|
|
t.Fatalf("listen unix socket: %v", err)
|
|
}
|
|
defer ln.Close()
|
|
|
|
acceptDone := make(chan struct{})
|
|
go func() {
|
|
conn, _ := ln.Accept()
|
|
if conn != nil {
|
|
conn.Close()
|
|
}
|
|
close(acceptDone)
|
|
}()
|
|
|
|
conn, err := dialIdentityAgent(socketPath)
|
|
if err != nil {
|
|
t.Fatalf("dialIdentityAgent: %v", err)
|
|
}
|
|
conn.Close()
|
|
<-acceptDone
|
|
}
|