diff --git a/pkg/nodes/nodes.go b/pkg/nodes/nodes.go index a49a2a0f..d68ad79d 100644 --- a/pkg/nodes/nodes.go +++ b/pkg/nodes/nodes.go @@ -41,7 +41,6 @@ type ExternalNodeConfig struct { // SCPFileToNode copies a file from the local machine to the specific node created. func (n *Node) SCPFileToNode(localPath, remotePath string) error { signer, err := ssh.ParsePrivateKey(n.SSHKey) - if err != nil { return err } @@ -109,13 +108,15 @@ func (n *Node) ExecuteCommand(command string) (string, error) { if err != nil { return outputString, err } + defer client.Close() session, err := client.NewSession() if err != nil { return outputString, err } + defer session.Close() - output, err = session.Output(command) + output, err = session.CombinedOutput(command) outputString = string(output) return outputString, err }