Commit 8bb2726d by Ian Lance Taylor

cmd/go: force LANG=C when looking for compiler version

    
    Tested by installing the gcc-locales package and running
        LANG=de_DE.utf8 go build hello.go
    Without this change, that fails, as described at
    https://gcc.gnu.org/PR84765.
    
    Reviewed-on: https://go-review.googlesource.com/100737

From-SVN: r258565
parent e0c079cb
ce28919112dbb234366816ab39ce060ad45e8ca9 e4464efc767b8dee4f4c18ffaf6c891f7b9deee7
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -234,7 +234,18 @@ func (b *Builder) gccgoToolID(name, language string) (string, error) { ...@@ -234,7 +234,18 @@ func (b *Builder) gccgoToolID(name, language string) (string, error) {
// compile an empty file on standard input. // compile an empty file on standard input.
cmdline := str.StringList(cfg.BuildToolexec, name, "-###", "-x", language, "-c", "-") cmdline := str.StringList(cfg.BuildToolexec, name, "-###", "-x", language, "-c", "-")
cmd := exec.Command(cmdline[0], cmdline[1:]...) cmd := exec.Command(cmdline[0], cmdline[1:]...)
cmd.Env = base.EnvForDir(cmd.Dir, os.Environ())
// Strip any LANG or LC_ environment variables, and force
// LANG=C, so that we get the untranslated output.
var env []string
for _, e := range os.Environ() {
if !strings.HasPrefix(e, "LANG=") && !strings.HasPrefix(e, "LC_") {
env = append(env, e)
}
}
env = append(env, "LANG=C")
cmd.Env = base.EnvForDir(cmd.Dir, env)
out, err := cmd.CombinedOutput() out, err := cmd.CombinedOutput()
if err != nil { if err != nil {
return "", fmt.Errorf("%s: %v; output: %q", name, err, out) return "", fmt.Errorf("%s: %v; output: %q", name, err, out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment