cli/connhelper: raise remote binary evaluation out of dialer context

Signed-off-by: Matthew MacLeod <matt@umm.io>
This commit is contained in:
Matthew MacLeod 2024-11-18 15:26:37 +00:00
parent 43dbdcfe1e
commit 43dd6ea464
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -54,9 +54,10 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*ConnectionHelper
} }
sshFlags = addSSHTimeout(sshFlags) sshFlags = addSSHTimeout(sshFlags)
sshFlags = disablePseudoTerminalAllocation(sshFlags) sshFlags = disablePseudoTerminalAllocation(sshFlags)
remoteDockerBinary := dockerSSHRemoteBinary()
return &ConnectionHelper{ return &ConnectionHelper{
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) { Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
args := []string{dockerSSHRemoteBinary()} args := []string{remoteDockerBinary}
if sp.Path != "" { if sp.Path != "" {
args = append(args, "--host", "unix://"+sp.Path) args = append(args, "--host", "unix://"+sp.Path)
} }