Show scp output on error

This commit is contained in:
Matthew Hooker 2017-08-10 11:46:38 -07:00
parent 48d8670838
commit ea76b5a693
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 5 additions and 0 deletions

View File

@ -693,6 +693,11 @@ func (c *comm) scpSession(scpCommand string, f func(io.Writer, *bufio.Reader) er
// Otherwise, we have an ExitErorr, meaning we can just read
// the exit status
log.Printf("non-zero exit status: %d", exitErr.ExitStatus())
stdoutB, err := ioutil.ReadAll(stdoutR)
if err != nil {
return err
}
log.Printf("scp output: %s", stdoutB)
// If we exited with status 127, it means SCP isn't available.
// Return a more descriptive error for that.