mirror of https://github.com/golang/go.git
misc/cgo/testshared: do not capture output of go commands in verbose mode
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>
This commit is contained in:
parent
cf2736c4c5
commit
9262e2183b
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue