Skip to content

Commit 64f19d7

Browse files
egonelbredr2chase
authored andcommitted
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 <[email protected]>
1 parent 553a862 commit 64f19d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmd/compile/internal/logopt/logopt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func testCopy(t *testing.T, dir, goarch, goos, src, outfile string) (string, err
199199
t.Log(run)
200200
cmd := exec.Command(run[0], run[1:]...)
201201
cmd.Dir = dir
202-
cmd.Env = []string{"GOARCH=" + goarch, "GOOS=" + goos}
202+
cmd.Env = append(os.Environ(), "GOARCH="+goarch, "GOOS="+goos)
203203
out, err := cmd.CombinedOutput()
204204
t.Logf("%s", out)
205205
return string(out), err

0 commit comments

Comments
 (0)