mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
fix(envs): 🐛 set environment variable instead of bash variable (#219)
This commit is contained in:
parent
0a6e4de21c
commit
cc7a2d5983
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user