Skip to content

Commit 9b4bd49

Browse files
committed
Log stderr on test failure
1 parent a839fc0 commit 9b4bd49

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/gvm/use_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"bytes"
5+
"errors"
56
"fmt"
67
"io"
78
"os"
@@ -73,7 +74,12 @@ func TestGVMRunUse(t *testing.T) {
7374
// Test that GOROOT/bin/go exists and is the correct version.
7475
version, err := exec.Command(filepath.Join(goroot, "bin", "go"), "version").Output()
7576
if err != nil {
76-
t.Fatal("failed to run go version", err)
77+
var exitErr *exec.ExitError
78+
if errors.As(err, &exitErr) {
79+
t.Fatalf("failed to run go version: %v\n%s", err, exitErr.Stderr)
80+
} else {
81+
t.Fatal("failed to run go version", err)
82+
}
7783
}
7884
assert.Contains(t, string(version), tc.Version)
7985
})

0 commit comments

Comments
 (0)