aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/exec_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-11-13 11:09:27 -0800
committerIan Lance Taylor <iant@golang.org>2019-11-13 21:24:35 +0000
commit718f553915cc1c13d7b31cd264c131987f67f14d (patch)
treeca4e4db9050c030f1de95069226029e819141138 /src/os/exec/exec_test.go
parent49e05d4f91771fc6f090238a6a8c5f1796b01afe (diff)
downloadgo-718f553915cc1c13d7b31cd264c131987f67f14d.tar.gz
go-718f553915cc1c13d7b31cd264c131987f67f14d.zip
os/exec: skip poll descriptors when checking for open descriptors
It turns out that there is a path that initializes netpoll and opens file descriptors before running the os/exec init function: on some systems, the uses of NewFile when setting os.Stdin and friends can initialize netpoll which can open file descriptors. This in itself is not a problem, but when we check whether the new files are open using os.NewFile, a side-effect is to put them into non-blocking mode. This can then break future uses of netpoll. Updates #35469 Fixes #35566 Change-Id: I1b2e2c943695d1c2d29496b050abbce9ee710a00 Reviewed-on: https://go-review.googlesource.com/c/go/+/207078 Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/os/exec/exec_test.go')
-rw-r--r--src/os/exec/exec_test.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index 0498c7d915..19bda6902a 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -47,6 +47,9 @@ func init() {
return
}
for fd := uintptr(3); fd <= 100; fd++ {
+ if poll.IsPollDescriptor(fd) {
+ continue
+ }
// We have no good portable way to check whether an FD is open.
// We use NewFile to create a *os.File, which lets us
// know whether it is open, but then we have to cope with