Commit 0dd4a4d8 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/plugin: clean up stderr

parent 52dbb3c4
......@@ -8,6 +8,7 @@ import (
"github.com/mitchellh/packer/packer"
packrpc "github.com/mitchellh/packer/packer/rpc"
"io"
"io/ioutil"
"log"
"net/rpc"
"os"
......@@ -99,6 +100,10 @@ func NewClient(config *ClientConfig) (c *Client) {
config.StartTimeout = 1 * time.Minute
}
if config.Stderr == nil {
config.Stderr = ioutil.Discard
}
c = &Client{config: config}
if config.Managed {
managedClients = append(managedClients, c)
......@@ -300,10 +305,7 @@ func (c *Client) logStderr(r io.Reader) {
line, err := bufR.ReadString('\n')
if line != "" {
log.Printf("%s: %s", c.config.Cmd.Path, line)
if c.config.Stderr != nil {
c.config.Stderr.Write([]byte(line))
}
c.config.Stderr.Write([]byte(line))
}
if err == io.EOF {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment