1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:50:05 -07:00

os/exec: fix Win32 tests missing 'chcp'

'%SystemRoot%/System32/chcp.com' is a tool on Windows that
is used to change the active code page in the console.

'go test os/exec' can fail with:
"'chcp' is not recognized as an internal or external command"

The test uses a custom PATH variable but does not include
'%SystemRoot%/System32'. Always append that to PATH.

Updates #24709
This commit is contained in:
Lubomir I. Ivanov (VMware) 2018-04-25 22:49:42 +03:00
parent 7500b29993
commit fb930529bb

View File

@ -117,7 +117,7 @@ func createEnv(dir, PATH, PATHEXT string) []string {
dirs[i] = filepath.Join(dir, dirs[i])
}
path := strings.Join(dirs, ";")
env = updateEnv(env, "PATH", path)
env = updateEnv(env, "PATH", os.Getenv("SystemRoot") + "/System32;" + path)
return env
}