From ba68011b55ccd04284e4b835e224b6806f65a84e Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Wed, 27 Dec 2017 09:32:24 -0200 Subject: [PATCH] fix: env --- pipeline/fpm/fpm.go | 7 +++++++ pipeline/fpm/fpm_test.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pipeline/fpm/fpm.go b/pipeline/fpm/fpm.go index 846538c65..31415850a 100644 --- a/pipeline/fpm/fpm.go +++ b/pipeline/fpm/fpm.go @@ -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 } diff --git a/pipeline/fpm/fpm_test.go b/pipeline/fpm/fpm_test.go index bc4479917..23cb51daa 100644 --- a/pipeline/fpm/fpm_test.go +++ b/pipeline/fpm/fpm_test.go @@ -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) }