Skip to content

Commit 0fd3fb0

Browse files
committed
cli/connhelper: getConnectionHelper: move ssh-option funcs out of closure
The addSSHTimeout and disablePseudoTerminalAllocation were added in commits a5ebe22 and f3c2c26, and called inside the Dialer function, which means they're called every time the Dialer is called. Given that the sshFlags slice is not mutated by the Dialer, we can call these functions once. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 1a7b7dd commit 0fd3fb0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cli/connhelper/connhelper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ func getConnectionHelper(daemonURL string, sshFlags []string) (*ConnectionHelper
4545
if err != nil {
4646
return nil, errors.Wrap(err, "ssh host connection is not valid")
4747
}
48+
sshFlags = addSSHTimeout(sshFlags)
49+
sshFlags = disablePseudoTerminalAllocation(sshFlags)
4850
return &ConnectionHelper{
4951
Dialer: func(ctx context.Context, network, addr string) (net.Conn, error) {
5052
args := []string{"docker"}
5153
if sp.Path != "" {
5254
args = append(args, "--host", "unix://"+sp.Path)
5355
}
54-
sshFlags = addSSHTimeout(sshFlags)
55-
sshFlags = disablePseudoTerminalAllocation(sshFlags)
5656
args = append(args, "system", "dial-stdio")
5757
return commandconn.New(ctx, "ssh", append(sshFlags, sp.Args(args...)...)...)
5858
},

0 commit comments

Comments
 (0)