From: Egon Elbre Date: Tue, 7 Apr 2020 12:52:05 +0000 (+0300) Subject: cmd/compile/internal/logopt: preserve env while running command X-Git-Tag: go1.15beta1~646 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=64f19d70805a6da347a55dab5ab4f4c57ddb3278;p=gostls13.git cmd/compile/internal/logopt: preserve env while running command The test was not preserving temporary directory flags leading to a failure on windows with: mkdir C:\WINDOWS\go-build315158903: Access is denied. Fixes #38251 Change-Id: I6ee31b31e84b7f6e75ea6ee0f3b8c094835bf5d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/227497 Reviewed-by: David Chase --- diff --git a/src/cmd/compile/internal/logopt/logopt_test.go b/src/cmd/compile/internal/logopt/logopt_test.go index 040d8cee0b..cc28536fd4 100644 --- a/src/cmd/compile/internal/logopt/logopt_test.go +++ b/src/cmd/compile/internal/logopt/logopt_test.go @@ -199,7 +199,7 @@ func testCopy(t *testing.T, dir, goarch, goos, src, outfile string) (string, err t.Log(run) cmd := exec.Command(run[0], run[1:]...) cmd.Dir = dir - cmd.Env = []string{"GOARCH=" + goarch, "GOOS=" + goos} + cmd.Env = append(os.Environ(), "GOARCH="+goarch, "GOOS="+goos) out, err := cmd.CombinedOutput() t.Logf("%s", out) return string(out), err