Don't leak ssh connections

Without this fix, the underlying network connection is never closed.
This commit is contained in:
Maciej Borsz 2019-06-13 15:26:57 +02:00
parent fd66d37b3a
commit 4d3db1873f

View File

@ -190,6 +190,7 @@ func runSSHCommand(dialer sshDialer, cmd, user, host string, signer ssh.Signer,
if err != nil {
return "", "", 0, fmt.Errorf("error getting SSH client to %s@%s: '%v'", user, host, err)
}
defer client.Close()
session, err := client.NewSession()
if err != nil {
return "", "", 0, fmt.Errorf("error creating session to %s@%s: '%v'", user, host, err)