aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec/exec_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2019-04-29 16:36:21 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2019-04-29 19:08:13 +0000
commit06c9ccdfc7b9e39e0f609c00bddd1b39a0385a37 (patch)
tree378fb3f7fb58e300a834e1b956409592786a89f6 /src/os/exec/exec_test.go
parent8c1f78524e421ac01e35e8805dd7a45bf98c2a79 (diff)
downloadgo-06c9ccdfc7b9e39e0f609c00bddd1b39a0385a37.tar.gz
go-06c9ccdfc7b9e39e0f609c00bddd1b39a0385a37.zip
os/exec: always set SYSTEMROOT on Windows if not listed in Cmd.Env
Fixes #25210 Change-Id: If27b61776154dae9b9b67bf4e4f5faa785d98105 Reviewed-on: https://go-review.googlesource.com/c/go/+/174318 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/os/exec/exec_test.go')
-rw-r--r--src/os/exec/exec_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index 26be62dd92..a157810eed 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -1184,3 +1184,22 @@ func TestStringPathNotResolved(t *testing.T) {
t.Errorf("String(%q, %q) = %q, want %q", "makemeasandwich", "-lettuce", got, want)
}
}
+
+// start a child process without the user code explicitly starting
+// with a copy of the parent's. (The Windows SYSTEMROOT issue: Issue
+// 25210)
+func TestChildCriticalEnv(t *testing.T) {
+ testenv.MustHaveExec(t)
+ if runtime.GOOS != "windows" {
+ t.Skip("only testing on Windows")
+ }
+ cmd := helperCommand(t, "echoenv", "SYSTEMROOT")
+ cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"}
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if strings.TrimSpace(string(out)) == "" {
+ t.Error("no SYSTEMROOT found")
+ }
+}