packer/plugin: clean up stderr
This commit is contained in:
parent
467474910c
commit
31731414be
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue