using %q for quoting ssh command

This commit is contained in:
Brad Rydzewski 2014-10-28 20:59:13 -07:00
parent d14ae26a64
commit 3642c903c5

View file

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