fix: escaping special characters when passing env to ssh

This commit is contained in:
Damian Kaczmarek 2017-11-09 11:57:49 -06:00
parent 7220c94832
commit 15bdee9ea5
No known key found for this signature in database
GPG Key ID: 9C001AB68BDAF665
2 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ func (p Plugin) exec(host string, wg *sync.WaitGroup, errChannel chan error) {
key = strings.ToUpper(key) key = strings.ToUpper(key)
val := os.Getenv(key) val := os.Getenv(key)
val = strings.Replace(val, " ", "", -1) val = strings.Replace(val, " ", "", -1)
env = append(env, key+"="+val) env = append(env, key+"='"+val+"'")
} }
p.Config.Script = append(env, p.Config.Script...) p.Config.Script = append(env, p.Config.Script...)

View File

@ -232,7 +232,7 @@ func TestSSHCommandExitCodeError(t *testing.T) {
} }
func TestSetENV(t *testing.T) { func TestSetENV(t *testing.T) {
os.Setenv("FOO", "1") os.Setenv("FOO", "1)")
plugin := Plugin{ plugin := Plugin{
Config: Config{ Config: Config{
Host: []string{"localhost"}, Host: []string{"localhost"},