diff --git a/pkg/foxytest/testsuite.go b/pkg/foxytest/testsuite.go index f5e865a..e073cac 100644 --- a/pkg/foxytest/testsuite.go +++ b/pkg/foxytest/testsuite.go @@ -525,11 +525,13 @@ func (ts *testSuite) startExecutable(t TestRunner) *exec.Cmd { // and this only happens when using go test ./... , while not happening with simple go test // So would instead send stderr to the test log output + stderrPipeCreated := make(chan struct{}) go func() { errReader, err := cmd.StderrPipe() if err != nil { t.Fatalf("error creating stderr pipe: %v", err) } + close(stderrPipeCreated) scanner := bufio.NewScanner(errReader) for scanner.Scan() { t.Logf("stderr: %s", scanner.Text()) @@ -539,6 +541,8 @@ func (ts *testSuite) startExecutable(t TestRunner) *exec.Cmd { } }() + <-stderrPipeCreated + if ts.logging { t.Logf("running command: %s %s", ts.command, strings.Join(ts.args, " ")) }