1
0
mirror of https://github.com/golang/go synced 2024-09-30 04:34:33 -06:00

cmd/go: force untranslated output when running GCC/clang driver

When we look for the tool ID to use for a compiler, force untranslated
output so that we can match the literal string "version".

Fixes https://gcc.gnu.org/PR84765

Change-Id: I607df445dbd3c5a7c3a6907601adcb039ac16fc1
Reviewed-on: https://go-review.googlesource.com/111575
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Ian Lance Taylor 2018-05-04 14:32:59 -07:00
parent 8088a7fc12
commit 814c749c8f

View File

@ -235,6 +235,8 @@ func (b *Builder) gccgoToolID(name, language string) (string, error) {
cmdline := str.StringList(cfg.BuildToolexec, name, "-###", "-x", language, "-c", "-")
cmd := exec.Command(cmdline[0], cmdline[1:]...)
cmd.Env = base.EnvForDir(cmd.Dir, os.Environ())
// Force untranslated output so that we see the string "version".
cmd.Env = append(cmd.Env, "LC_ALL=C")
out, err := cmd.CombinedOutput()
if err != nil {
return "", fmt.Errorf("%s: %v; output: %q", name, err, out)