Fixes #11709.
Fixed #11449.
Change-Id: If8fdb27d3dc25fb7017226d143a29cbebc1374c5
Reviewed-on: https://go-review.googlesource.com/12483
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
"GOFILE=" + g.file,
"GOPACKAGE=" + g.pkg,
}
- cmd.Env = mergeEnvLists(env, os.Environ())
+ cmd.Env = mergeEnvLists(env, origEnv)
err := cmd.Run()
if err != nil {
g.errorf("running %q: %s", words[0], err)
tg.runFail("install")
tg.grepStderr("no install location for.*gopath2.src.test: hidden by .*gopath1.src.test", "missing error")
}
+
+func TestIssue11709(t *testing.T) {
+ tg := testgo(t)
+ defer tg.cleanup()
+ tg.tempFile("run.go", `
+ package main
+ import "os"
+ func main() {
+ if os.Getenv("TERM") != "" {
+ os.Exit(1)
+ }
+ }`)
+ tg.unsetenv("TERM")
+ tg.run("run", tg.path("run.go"))
+}
exitMu.Unlock()
}
+var origEnv []string
+
func main() {
_ = go11tag
flag.Usage = usage
// the same default computation of these as we do,
// but in practice there might be skew
// This makes sure we all agree.
+ origEnv = os.Environ()
for _, env := range mkEnv() {
if os.Getenv(env.name) != env.value {
os.Setenv(env.name, env.value)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
+ cmd.Env = origEnv
startSigHandlers()
if err := cmd.Run(); err != nil {
errorf("%v", err)