test/integration: RunCmd must write to buffers even in verbose mode

Otherwise in verbose mode stdout.String() and stderr.String() would be
always empty.

Change-Id: I6be3adb8905865d99af07595a7f446812b545338
This commit is contained in:
mpl 2014-11-10 22:40:14 +01:00
parent d7e5128bbe
commit cc079cff2d
1 changed files with 3 additions and 2 deletions

View File

@ -20,6 +20,7 @@ import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"net"
@ -319,8 +320,8 @@ func GetWorldMaybe(t *testing.T) *World {
func RunCmd(c *exec.Cmd) (output string, err error) {
var stdout, stderr bytes.Buffer
if testing.Verbose() {
c.Stderr = os.Stdout
c.Stdout = os.Stderr
c.Stderr = io.MultiWriter(os.Stderr, &stderr)
c.Stdout = io.MultiWriter(os.Stdout, &stdout)
} else {
c.Stderr = &stderr
c.Stdout = &stdout