This patch normalizes the locale settings in utils.Exec to fix parsing issues due to different locales.
This commit is contained in:
Lorenz Brun 2015-11-16 20:47:15 +01:00
parent f229083e1e
commit ad386a2451

View File

@ -18,6 +18,8 @@ package utils
import (
"bytes"
"os/exec"
"os"
"strings"
)
// Exec runs the given binary with arguments
@ -29,6 +31,17 @@ func Exec(dir string, bin string, args ...string) ([]byte, error) {
cmd := exec.Command(bin, args...)
cmd.Dir = dir
env := os.Environ()
for i, v := range env {
if strings.HasPrefix(v,"LANG=") {
env[i] = "LANG=C"
}
if strings.HasPrefix(v,"LANGUAGE=") {
env[i] = "LANGUAGE=C"
}
}
cmd.Env = env
var buf bytes.Buffer
cmd.Stdout = &buf