From ea76b5a6935d5535123e2f2ecf283e68eb69731a Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Thu, 10 Aug 2017 11:46:38 -0700 Subject: [PATCH] Show scp output on error --- communicator/ssh/communicator.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index a6a7f9cf9..99ce03f67 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -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.