fix(envs): 🐛 set environment variable instead of bash variable (#219)

This commit is contained in:
Prashant Shahi 2023-01-08 06:06:33 +05:30 committed by GitHub
parent 0a6e4de21c
commit cc7a2d5983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -103,7 +103,7 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
for _, key := range p.Config.Envs {
key = strings.ToUpper(key)
if val, found := os.LookupEnv(key); found {
env = append(env, key+"="+escapeArg(val))
env = append(env, "export "+key+"="+escapeArg(val))
}
}

View File

@ -539,13 +539,13 @@ func TestEnvOutput(t *testing.T) {
echo "[${ENV_7}]"
======END======
======ENV======
ENV_1='test'
ENV_2='test test'
ENV_3='test '
ENV_4=' test test '
ENV_5='test'\'''
ENV_6='test"'
ENV_7='test,!#;?.@$~'\''"'
export ENV_1='test'
export ENV_2='test test'
export ENV_3='test '
export ENV_4=' test test '
export ENV_5='test'\'''
export ENV_6='test"'
export ENV_7='test,!#;?.@$~'\''"'
======END======
out: [test]
out: [test test]