]> Cypherpunks repositories - gostls13.git/commitdiff
misc/cgo/testshared: do not capture output of go commands in verbose mode
authorMichael Hudson-Doyle <michael.hudson@canonical.com>
Tue, 26 May 2015 22:30:55 +0000 (10:30 +1200)
committerIan Lance Taylor <iant@golang.org>
Wed, 27 May 2015 04:46:29 +0000 (04:46 +0000)
Change-Id: I8694ee5e5642c31815ae63cd414a3b1fcd9c95b0
Reviewed-on: https://go-review.googlesource.com/10411
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

misc/cgo/testshared/shared_test.go

index fd577b03b5108b28bda4c3433af6d64bc3b17d8f..c7f998c5c00d82464e9fe7d7830758a4e7b84b4c 100644 (file)
@@ -47,10 +47,17 @@ func goCmd(t *testing.T, args ...string) {
        }
        newargs = append(newargs, args[1:]...)
        c := exec.Command("go", newargs...)
+       var output []byte
+       var err error
        if testing.Verbose() {
                fmt.Printf("+ go %s\n", strings.Join(newargs, " "))
+               c.Stdout = os.Stdout
+               c.Stderr = os.Stderr
+               err = c.Run()
+       } else {
+               output, err = c.CombinedOutput()
        }
-       if output, err := c.CombinedOutput(); err != nil {
+       if err != nil {
                if t != nil {
                        t.Errorf("executing %s failed %v:\n%s", strings.Join(c.Args, " "), err, output)
                } else {