From 48f4d499f9445e9c1d575ca8f22643f4b78b84bd Mon Sep 17 00:00:00 2001 From: Sander van Harmelen Date: Tue, 5 May 2015 21:26:28 +0200 Subject: [PATCH] Fixing a small vet warning introduced by PR #1796 While fixing the vet warning also tried to improve any feedback by showing the actual output/error instead of just the error code. While testing this I noticed only adding stderr output is not enough as not all error info is send to stderr, but sometimes also to stdout. --- communicator/ssh/communicator.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index 7b0fa510f..95cd58136 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -229,8 +229,11 @@ func (c *Communicator) UploadScript(path string, input io.Reader) error { return err } + var stdout, stderr bytes.Buffer cmd := &remote.Cmd{ Command: fmt.Sprintf("chmod 0777 %s", path), + Stdout: &stdout, + Stderr: &stderr, } if err := c.Start(cmd); err != nil { return fmt.Errorf( @@ -241,7 +244,7 @@ func (c *Communicator) UploadScript(path string, input io.Reader) error { if cmd.ExitStatus != 0 { return fmt.Errorf( "Error chmodding script file to 0777 in remote "+ - "machine: exit status=%s", cmd.ExitStatus) + "machine: %s %s", stdout.String(), stderr.String()) } return nil