From 00338a0b85543474b9608ed19c3fc2d8c7df505b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 31 Jul 2013 09:37:03 -0700 Subject: [PATCH] packer/plugin: trim whitespace on right of log data from plugin --- packer/plugin/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packer/plugin/client.go b/packer/plugin/client.go index fbc458518..e380bf850 100644 --- a/packer/plugin/client.go +++ b/packer/plugin/client.go @@ -16,6 +16,7 @@ import ( "strings" "sync" "time" + "unicode" ) // This is a slice of the "managed" clients which are cleaned up when @@ -306,8 +307,10 @@ func (c *Client) logStderr(r io.Reader) { for { line, err := bufR.ReadString('\n') if line != "" { - log.Printf("%s: %s", c.config.Cmd.Path, line) c.config.Stderr.Write([]byte(line)) + + line = strings.TrimRightFunc(line, unicode.IsSpace) + log.Printf("%s: %s", c.config.Cmd.Path, line) } if err == io.EOF {