Skip to content

Commit

Permalink
os/exec: fix Win32 tests missing chcp
Browse files Browse the repository at this point in the history
`%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.

Ref golang#24709
  • Loading branch information
neolit123 committed Apr 25, 2018
1 parent 7500b29 commit 63a224c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/os/exec/lp_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 63a224c

Please sign in to comment.