aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/read3.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-04-22 23:33:16 -0400
committerBryan Mills <bcmills@google.com>2022-04-26 14:49:07 +0000
commit7b31af0eae8ce369d5ffd16be1de0b2f0121e7c2 (patch)
tree7b7097d33aa1c4b0fbc23c85b1f95d4124c4662d /src/os/exec/read3.go
parentad5eaa8c4cd952df0d4894f11ee0158a9a33a0f3 (diff)
downloadgo-7b31af0eae8ce369d5ffd16be1de0b2f0121e7c2.tar.gz
go-7b31af0eae8ce369d5ffd16be1de0b2f0121e7c2.zip
os/exec: use a TestMain to avoid hijacking stdout for helper commands
The previous implementation of helperCommand relied on running a well-known Test function which implemented all known commands. That not only added Skip noise in the test's output, but also (and more importantly) meant that the commands could not write directly to stdout in the usual way, since the testing package hijacks os.Stdout for its own use. The new implementation addresses the above issues, and also ensures that all registered commands are actually used, reducing the risk of an unused command sticking around after refactoring. It also sets the subprocess environment variable directly in the test process, instead of on each individual helper command's Env field, allowing helper commands to be used without an explicit Env. Updates #50599. (Also for #50436.) Change-Id: I189c7bed9a07cfe47a084b657b88575b1ee370b9 Reviewed-on: https://go-review.googlesource.com/c/go/+/401934 Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/os/exec/read3.go')
-rw-r--r--src/os/exec/read3.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/os/exec/read3.go b/src/os/exec/read3.go
index 10cbfbd54a..8327d73e51 100644
--- a/src/os/exec/read3.go
+++ b/src/os/exec/read3.go
@@ -6,7 +6,7 @@
// This is a test program that verifies that it can read from
// descriptor 3 and that no other descriptors are open.
-// This is not done via TestHelperProcess and GO_WANT_HELPER_PROCESS
+// This is not done via TestHelperProcess and GO_EXEC_TEST_PID
// because we want to ensure that this program does not use cgo,
// because C libraries can open file descriptors behind our backs
// and confuse the test. See issue 25628.