Skip to content

Commit 6a4701e

Browse files
committed
cmd/go: use exit status from test binary on error
Fixes #45508
1 parent 3f4977b commit 6a4701e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cmd/go/internal/test/test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,10 @@ func (c *runCache) builderRunTest(b *work.Builder, ctx context.Context, a *work.
12731273
c.saveOutput(a)
12741274
} else {
12751275
base.SetExitStatus(1)
1276+
if exitErr := (*exec.ExitError)(nil); errors.As(err, &exitErr) {
1277+
base.SetExitStatus(exitErr.ExitCode())
1278+
}
1279+
12761280
// If there was test output, assume we don't need to print the exit status.
12771281
// Buf there's no test output, do print the exit status.
12781282
if len(out) == 0 {

0 commit comments

Comments
 (0)