1
0
mirror of https://github.com/golang/go synced 2024-09-29 08:14:29 -06:00
The Go programming language
Go to file
Andrew Gerrand ab9d31da9e cmd/go/internal/test: wrap os.Stdout always
There is an issue where 'go test' will hang after the tests complete if
a test starts a sub-process that does not exit (see #24050).

However, go test only exhibits that behavior when a package name is
explicitly passed as an argument. If 'go test' is invoked without any
package arguments then the package in the working directory is assumed,
however in that case (and only that case) os.Stdout is used as the test
process's cmd.Stdout, which does *not* cause 'go test' wait for the
sub-process to exit (see #23019).

This change wraps os.Stdout in an io.Writer struct in this case, hiding
the *os.File from the os/exec package, causing cmd.Wait to always wait
for the full output from the test process and any of its sub-processes.

In other words, this makes 'go test' exhibit the same behavior as
'go test .' (or 'go test ./...' and so on).

Update #23019
Update #24050

Change-Id: Ica09bf156f3b017f9a31aad91ed0f16a7837195b
Reviewed-on: https://go-review.googlesource.com/c/go/+/400877
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Andrew Gerrand <adg@golang.org>
Auto-Submit: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-04-21 00:45:18 +00:00
.github .github: remove duplicate security link 2022-01-07 17:55:09 +00:00
api encoding/binary: add AppendVarint AppendUvarint 2022-04-15 01:19:37 +00:00
doc spec: clarify rules for type set construction of an interface 2022-04-19 23:42:38 +00:00
lib/time
misc all: gofmt main repo 2022-04-11 16:34:30 +00:00
src cmd/go/internal/test: wrap os.Stdout always 2022-04-21 00:45:18 +00:00
test cmd/compile/internal/types2: use correct value of iota 2022-04-19 23:20:21 +00:00
.gitattributes
.gitignore
AUTHORS A+C: add Wen Yang (individual CLA) 2022-04-11 22:24:03 +00:00
codereview.cfg
CONTRIBUTING.md
CONTRIBUTORS A+C: add Wen Yang (individual CLA) 2022-04-11 22:24:03 +00:00
LICENSE
PATENTS
README.md README.md: update links to go.dev 2022-03-20 16:05:03 +00:00
SECURITY.md

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://go.dev/dl/.

After downloading a binary release, visit https://go.dev/doc/install for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.