mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
misc/cgo/testcshared: force descriptor 30 to be closed when execing test
Fixes #26730 Change-Id: I3396598282c814e75c0c4ef16f692dbe83d2935e Reviewed-on: https://go-review.googlesource.com/127395 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
859a944ee2
commit
a7df7b9cdb
1 changed files with 10 additions and 0 deletions
|
|
@ -201,6 +201,16 @@ func run(t *testing.T, env []string, args ...string) string {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
cmd := exec.Command(args[0], args[1:]...)
|
cmd := exec.Command(args[0], args[1:]...)
|
||||||
cmd.Env = env
|
cmd.Env = env
|
||||||
|
|
||||||
|
if GOOS != "windows" {
|
||||||
|
// TestUnexportedSymbols relies on file descriptor 30
|
||||||
|
// being closed when the program starts, so enforce
|
||||||
|
// that in all cases. (The first three descriptors are
|
||||||
|
// stdin/stdout/stderr, so we just need to make sure
|
||||||
|
// that cmd.ExtraFiles[27] exists and is nil.)
|
||||||
|
cmd.ExtraFiles = make([]*os.File, 28)
|
||||||
|
}
|
||||||
|
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("command failed: %v\n%v\n%s\n", args, err, out)
|
t.Fatalf("command failed: %v\n%v\n%s\n", args, err, out)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue