Skip to content

Commit

Permalink
Fix logging issue for error cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
paultyng committed Aug 20, 2020
1 parent 27f8e13 commit 115cc63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tfexec/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ func (tf *Terraform) runTerraformCmd(cmd *exec.Cmd) error {

stdout := tf.stdout
if cmd.Stdout != nil {
stdout = io.MultiWriter(cmd.Stdout, stdout)
stdout = io.MultiWriter(stdout, cmd.Stdout)
}
cmd.Stdout = stdout

stderr := io.MultiWriter(&errBuf, tf.stderr)
if cmd.Stderr != nil {
stderr = io.MultiWriter(cmd.Stderr, stderr)
stderr = io.MultiWriter(stderr, cmd.Stderr)
}
cmd.Stderr = stderr

Expand Down
3 changes: 2 additions & 1 deletion tfexec/internal/e2etest/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"

"github.com/hashicorp/go-version"
Expand Down Expand Up @@ -62,7 +63,7 @@ func runTestVersions(t *testing.T, versions []string, fixtureName string, cb fun
}
}

var stdouterr bytes.Buffer
var stdouterr strings.Builder
tf.SetStdout(&stdouterr)
tf.SetStderr(&stdouterr)

Expand Down

0 comments on commit 115cc63

Please sign in to comment.