aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/exec_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/exec/exec_test.go')
-rw-r--r--src/os/exec/exec_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index 822f606d66..13715fecac 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -38,6 +38,13 @@ import (
var haveUnexpectedFDs bool
func init() {
+ godebug := os.Getenv("GODEBUG")
+ if godebug != "" {
+ godebug += ","
+ }
+ godebug += "execwait=2"
+ os.Setenv("GODEBUG", godebug)
+
if os.Getenv("GO_EXEC_TEST_PID") != "" {
return
}
@@ -76,6 +83,14 @@ func TestMain(m *testing.M) {
}
}
}
+
+ if !testing.Short() {
+ // Run a couple of GC cycles to increase the odds of detecting
+ // process leaks using the finalizers installed by GODEBUG=execwait=2.
+ runtime.GC()
+ runtime.GC()
+ }
+
os.Exit(code)
}