aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/debug
diff options
context:
space:
mode:
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>2025-04-24 16:38:58 +0200
committerAlan Donovan <adonovan@google.com>2025-04-24 12:01:27 -0700
commit3672a09a48464d18d0c669cc3590d13091a2e77a (patch)
treea1e03851350bd2a9838e7fcfa4ea119d03ffe475 /src/runtime/debug
parent3452d80da3cf4f08da0f5905b1aa19cec475936e (diff)
downloadgo-3672a09a48464d18d0c669cc3590d13091a2e77a.tar.xz
runtime/debug: update SetCrashOutput example to not pass parent env vars
Fixes #73490 Change-Id: I500fa73f4215c7f490779f53c1c2c0d775f51a95 Reviewed-on: https://go-review.googlesource.com/c/go/+/667775 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/debug')
-rw-r--r--src/runtime/debug/example_monitor_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/runtime/debug/example_monitor_test.go b/src/runtime/debug/example_monitor_test.go
index 3b8f4dccd9..ed6757df85 100644
--- a/src/runtime/debug/example_monitor_test.go
+++ b/src/runtime/debug/example_monitor_test.go
@@ -84,7 +84,10 @@ func monitor() {
log.Fatal(err)
}
cmd := exec.Command(exe, "-test.run=^ExampleSetCrashOutput_monitor$")
- cmd.Env = append(os.Environ(), monitorVar+"=1")
+ // Be selective in which variables we allow the child to inherit.
+ // Depending on the application, some may be necessary,
+ // while others (e.g. GOGC, GOMEMLIMIT) may be harmful; see #73490.
+ cmd.Env = []string{monitorVar + "=1"}
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stderr
pipe, err := cmd.StdinPipe()