]> Cypherpunks repositories - gostls13.git/commit
os/exec: deflake TestPipeLookPathLeak
authorMichael Munday <munday@ca.ibm.com>
Thu, 23 Feb 2017 21:09:05 +0000 (16:09 -0500)
committerMichael Munday <munday@ca.ibm.com>
Fri, 24 Feb 2017 22:48:00 +0000 (22:48 +0000)
commit221bc23af6feeab821c49ad11f4661270d310ecd
treee947e5e4628c3b8e8623ed87737909521c92690b
parentfdef951116ea5e201866b7d4a53c8c90056770f4
os/exec: deflake TestPipeLookPathLeak

The number of open file descriptors reported by lsof is unreliable
because it depends on whether the parent process (the test) closed
the file descriptors it passed into the child process (lsof) before
lsof runs.

Reading /proc/self/fd directly on Linux appears to be much more
reliable and still detects any file descriptor leaks originating
from attempting to run an executable that cannot be found (issue
#5071). If /proc/self/fd is not available (e.g. on Darwin) then we
fall back to lsof and tolerate small differences in open file
descriptor counts.

Fixes #19243.

Change-Id: I052b0c129e609010f1083e43a9911cba154117bf
Reviewed-on: https://go-review.googlesource.com/37343
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/os/exec/exec_test.go