diff --git a/tfexec/cmd.go b/tfexec/cmd.go index 5a3e38e2..f5457769 100644 --- a/tfexec/cmd.go +++ b/tfexec/cmd.go @@ -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 diff --git a/tfexec/internal/e2etest/util_test.go b/tfexec/internal/e2etest/util_test.go index faf50454..0862b4a8 100644 --- a/tfexec/internal/e2etest/util_test.go +++ b/tfexec/internal/e2etest/util_test.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "path/filepath" + "strings" "testing" "github.com/hashicorp/go-version" @@ -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)