1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:14:40 -07:00

os/exec: replace os.Setenv with T.Setenv

Updates #45448

Change-Id: I570e9894c4976d0a875388ef9ea4a2aa31b78013
Reviewed-on: https://go-review.googlesource.com/c/go/+/310031
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Manlio Perillo 2021-04-14 12:57:21 +02:00 committed by Ian Lance Taylor
parent 4df3d0e4df
commit 492faaeda8

View File

@ -37,13 +37,7 @@ func TestLookPathUnixEmptyPath(t *testing.T) {
t.Fatal("Close failed: ", err)
}
pathenv := os.Getenv("PATH")
defer os.Setenv("PATH", pathenv)
err = os.Setenv("PATH", "")
if err != nil {
t.Fatal("Setenv failed: ", err)
}
t.Setenv("PATH", "")
path, err := LookPath("exec_me")
if err == nil {