From c9df164521f3cd7bbce2dcd7df02a7d4c060ec29 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov (VMware)" Date: Wed, 25 Apr 2018 22:49:42 +0300 Subject: [PATCH] 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 --- src/os/exec/lp_windows_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/exec/lp_windows_test.go b/src/os/exec/lp_windows_test.go index d1c90461747762..64d7dca2e85f12 100644 --- a/src/os/exec/lp_windows_test.go +++ b/src/os/exec/lp_windows_test.go @@ -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 }