1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00
This commit is contained in:
Carlos Alexandro Becker 2017-12-27 09:32:24 -02:00
parent 3d93a2dfce
commit ba68011b55
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/apex/log"
"github.com/pkg/errors"
@ -136,6 +137,12 @@ func cmd(options []string) *exec.Cmd {
/* #nosec */
var cmd = exec.Command("fpm", options...)
cmd.Env = []string{fmt.Sprintf("PATH=%s:%s", gnuTarPath, os.Getenv("PATH"))}
for _, env := range os.Environ() {
if strings.HasPrefix(env, "PATH=") {
continue
}
cmd.Env = append(cmd.Env, env)
}
return cmd
}

View File

@ -124,7 +124,7 @@ func TestCreateFileDoesntExist(t *testing.T) {
func TestCmd(t *testing.T) {
cmd := cmd([]string{"--help"})
assert.Len(t, cmd.Env, 1)
assert.NotEmpty(t, cmd.Env)
assert.Contains(t, cmd.Env[0], gnuTarPath)
}