Skip to content

Commit

Permalink
Merge pull request #10 from lpabon/returnbuf
Browse files Browse the repository at this point in the history
Return buffers on exit fail
  • Loading branch information
lpabon committed Feb 24, 2017
2 parents 1a408a6 + e878fac commit fcb3f13
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ func (s *SshExec) Exec(host string, commands []string, timeoutMinutes int, useSu
// Wait for either the command completion or timeout
select {
case err := <-errch:
buffers[index] = b.String()
if err != nil {
return nil, fmt.Errorf("Failed to run command [%v] on %v: Err[%v]: Stdout [%v]: Stderr [%v]",
return buffers, fmt.Errorf("Failed to run command [%v] on %v: Err[%v]: Stdout [%v]: Stderr [%v]",
command, host, err, b.String(), berr.String())
}
//LOG("Host: %v Command: %v\nResult: %v", host, command, b.String())
buffers[index] = b.String()

case <-timeout:
err := session.Signal(ssh.SIGKILL)
Expand Down

0 comments on commit fcb3f13

Please sign in to comment.