Force LANG=C before appending rest of environment, as only first occurence is used

This commit is contained in:
Jaime Soriano Pastor 2014-05-08 17:11:19 +02:00
parent a719c83dc8
commit 32bb745734
3 changed files with 3 additions and 5 deletions

View File

@ -89,8 +89,8 @@ func (c *Communicator) UploadDir(dst string, src string, exclude []string) error
var stderr bytes.Buffer
cmd := ShellCommand(cpCmd)
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Env = append(cmd.Env, "LANG=C")
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Stderr = &stderr
err = cmd.Run()
if err == nil {

View File

@ -34,11 +34,10 @@ func (f *IfconfigIPFinder) HostIP() (string, error) {
stdout := new(bytes.Buffer)
cmd := exec.Command(ifconfigPath, device)
cmd.Env = append(cmd.Env, os.Environ()...)
// Force LANG=C so that the output is what we expect it to be
// despite the locale.
cmd.Env = append(cmd.Env, "LANG=C")
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Stdout = stdout
cmd.Stderr = new(bytes.Buffer)

View File

@ -33,11 +33,10 @@ func (f *IfconfigIPFinder) HostIP() (string, error) {
stdout := new(bytes.Buffer)
cmd := exec.Command(ifconfigPath, f.Device)
cmd.Env = append(cmd.Env, os.Environ()...)
// Force LANG=C so that the output is what we expect it to be
// despite the locale.
cmd.Env = append(cmd.Env, "LANG=C")
cmd.Env = append(cmd.Env, os.Environ()...)
cmd.Stdout = stdout
cmd.Stderr = new(bytes.Buffer)