Merge pull request #621 from nils-werner/ssh-quotes

Wrap ssh cmd in quotes
This commit is contained in:
Brad Rydzewski 2014-10-28 20:57:25 -07:00
commit 13fedafc59
2 changed files with 2 additions and 2 deletions

View file

@ -81,7 +81,7 @@ func (s *SSH) Write(f *buildfile.Buildfile) {
}
if len(s.Cmd) > 0 {
sshCmd := "ssh -o StrictHostKeyChecking=no -p %s %s %s"
sshCmd := "ssh -o StrictHostKeyChecking=no -p %s %s \"%s\""
f.WriteCmd(fmt.Sprintf(sshCmd, host[1], strings.SplitN(host[0], ":", 2)[0], s.Cmd))
}
}

View file

@ -70,7 +70,7 @@ func TestSSHNoArtifact(t *testing.T) {
t.Error("Expect script not to contains scp command")
}
if !strings.Contains(bscr, "ssh -o StrictHostKeyChecking=no -p 22 user@test.example.com /opt/bin/redeploy.sh") {
if !strings.Contains(bscr, "ssh -o StrictHostKeyChecking=no -p 22 user@test.example.com \"/opt/bin/redeploy.sh\"") {
t.Error("Expect script to contains ssh command")
}
}