TBR: lib/exec: attempt to fix flakiness by setting GOMAXPROCS to 1

Change-Id: Ia69ad0df45e4869baa4b497333ab3ef9ad419ff2
diff --git a/lib/exec/exec_test.go b/lib/exec/exec_test.go
index 6426f8c..00e58ec 100644
--- a/lib/exec/exec_test.go
+++ b/lib/exec/exec_test.go
@@ -10,6 +10,7 @@
 	"log"
 	"os"
 	"os/exec"
+	"runtime"
 	"strings"
 	"sync"
 	"syscall"
@@ -31,6 +32,14 @@
 const baselineOpenFiles = 3
 
 func init() {
+	if os.Getenv("GOMAXPROCS") == "" {
+		// Set the number of logical processors to 1 if GOMAXPROCS is
+		// not set in the environment.
+		//
+		// TODO(caprita): the default in Go 1.5 is num cpus, which
+		// causes flakiness.  Figure out why.
+		runtime.GOMAXPROCS(1)
+	}
 	if os.Getenv("GO_WANT_HELPER_PROCESS_EXEC") == "1" {
 		return
 	}