mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
fix: env
This commit is contained in:
parent
3d93a2dfce
commit
ba68011b55
@ -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
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user