aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/exec_test.go
diff options
context:
space:
mode:
authorNick Patavalis <nick.patavalis@gmail.com>2018-03-11 19:11:33 +0200
committerIan Lance Taylor <iant@golang.org>2018-04-11 17:39:11 +0000
commitea5825b0b64e1a017a76eac0ad734e11ff557c8e (patch)
treed8e49068c0a2e6bffa3b4068360cfdb089560235 /src/os/exec/exec_test.go
parentab48574bab55eec033c4fed7f7eb4cedfaef90aa (diff)
downloadgo-ea5825b0b64e1a017a76eac0ad734e11ff557c8e.tar.gz
go-ea5825b0b64e1a017a76eac0ad734e11ff557c8e.zip
os: use poller when NewFile is called with a blocking descriptor.
If NewFile is called with a file descriptor that is already set to non-blocking mode, it tries to return a pollable file (one for which SetDeadline methods work) by adding the filedes to the poll/netpoll mechanism. If called with a filedes in blocking mode, it returns a non-pollable file, as it always did. Fixes #22939 Updates #24331 Change-Id: Id54c8be1b83e6d35e14e76d7df0e57a9fd64e176 Reviewed-on: https://go-review.googlesource.com/100077 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/os/exec/exec_test.go')
-rw-r--r--src/os/exec/exec_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index ed2a55557d..61ffcafcd5 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -404,6 +404,12 @@ var testedAlreadyLeaked = false
// stdin, stdout, stderr, epoll/kqueue, maybe testlog
func basefds() uintptr {
n := os.Stderr.Fd() + 1
+ // The poll (epoll/kqueue) descriptor can be numerically
+ // either between stderr and the testlog-fd, or after
+ // testlog-fd.
+ if poll.PollDescriptor() == n {
+ n++
+ }
for _, arg := range os.Args {
if strings.HasPrefix(arg, "-test.testlogfile=") {
n++