Show HN: A Go package to execute shell commands in specified order (github.com) 3 points by amalfra 8y ago ↗ HN
[–] noasiwiwiwu 8y ago ↗ HiYour software is broken by assuming a command can be split up into arguments by spaces, and also not letting the os package properly escape your arguments.https://github.com/amalfra/oexec/blob/master/oexec.go#L48Here's a command that would be impossible to execute with your software, notice how the last argument is a single argument: c := exec.Command( "/usr/bin/osascript", "-e", "say 5") output, err := c.CombinedOutput() [–] amalfra 8y ago ↗ Thanks for pointing it out. Won't quoting the command in the package's function call itself work, for eg:outs := oexec.Series("/usr/bin/osascript -e 'say 5'")I think even when running command in shell prompt arguments with space are supposed to be escaped with quotes
[–] amalfra 8y ago ↗ Thanks for pointing it out. Won't quoting the command in the package's function call itself work, for eg:outs := oexec.Series("/usr/bin/osascript -e 'say 5'")I think even when running command in shell prompt arguments with space are supposed to be escaped with quotes
3 comments
[ 4.1 ms ] story [ 17.4 ms ] threadYour software is broken by assuming a command can be split up into arguments by spaces, and also not letting the os package properly escape your arguments.
https://github.com/amalfra/oexec/blob/master/oexec.go#L48
Here's a command that would be impossible to execute with your software, notice how the last argument is a single argument:
outs := oexec.Series("/usr/bin/osascript -e 'say 5'")
I think even when running command in shell prompt arguments with space are supposed to be escaped with quotes