From 4f1b7eb507329452b089f26649319dbf0bef6cca Mon Sep 17 00:00:00 2001 From: Josh Komoroske Date: Mon, 26 Feb 2018 15:15:04 -0800 Subject: [PATCH] Preservation of forwarded environment --- plugin.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin.go b/plugin.go index 6ea65d8..947aafd 100644 --- a/plugin.go +++ b/plugin.go @@ -75,8 +75,9 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) { env := []string{} for _, key := range p.Config.Envs { key = strings.ToUpper(key) - val := os.Getenv(key) - env = append(env, key+"="+escapeArg(val)) + if val, found := os.LookupEnv(key); found { + env = append(env, key+"="+escapeArg(val)) + } } p.Config.Script = append(env, p.Config.Script...)