Closed SvenDowideit closed 1 year ago
exec.Command with ssh doesn't work when there are spaces in args
Injecting a shell script via stdin might be the easiest way
I was just playing with dumb ideas, and
newArgs := append([]string{"ssh", "-4", hostname})
for _, arg := range args {
newArgs = append(newArgs, "\""+arg+"\"")
}
return RunLocally(newArgs...)
seems to "work"
I think we can use this https://github.com/alessio/shellescape https://play.golang.org/p/xpUrKqkINqD
alternative Title:
exec.Command with ssh doesn't work when there are spaces in args
(I'm pondering how to best fix this for one of my apps too :) )