From 115cc631311cab0beb7cbe16d256fbd98a750ae7 Mon Sep 17 00:00:00 2001 From: Paul Tyng Date: Wed, 19 Aug 2020 20:57:28 -0400 Subject: [PATCH] Fix logging issue for error cmds --- tfexec/cmd.go | 4 ++-- tfexec/internal/e2etest/util_test.go | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) 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)