Skip to content

Commit dc1a9a6

Browse files
authored
Merge pull request #16 from tbg/runtimecontentionstacks=1
2 parents e7adc95 + bcc0dd5 commit dc1a9a6

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

exec.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ func spawnWith(in io.Reader, out, err io.Writer, args ...string) error {
5454
} else {
5555
cmd = exec.Command(args[0], args[1:]...)
5656
}
57+
58+
// Ensure that GODEBUG=[...,]runtimecontentionstacks=1 is set to improve
59+
// mutex profiles.
60+
env := os.Environ()
61+
envGodebug := os.Getenv("GODEBUG")
62+
if envGodebug != "" {
63+
envGodebug += ","
64+
}
65+
envGodebug += "runtimecontentionstacks=1"
66+
cmd.Env = append(env, "GODEBUG="+envGodebug)
67+
5768
cmd.Stdin = in
5869
cmd.Stdout = out
5970
cmd.Stderr = err

0 commit comments

Comments
 (0)