godo
godo copied to clipboard
how should I use os/exec in a task?
I want to write a task which creates a subprocess by specifying a program name and some arguments. godo provides .Bash and .Run, neither of which are appropriate for me, because they seem to mush together arguments into a single string which will cause all kinds of edge-case bugs. I want an interface like that of Command in os/exec, where I can specify the arguments as a list of strings. What is the recommended way to achieve this?
@The Bash and Run functions are sugar functions to aid in setting environment variables, template interpolation. strings.Join is an option if you have a slice of args.
ctx.Run("app " + strings.Join(args, " "))
@mgutz unfortunately strings.Join isn't an option due to the obvious bugs it would introduce (think strings.Join(string[]{"foo bar", "baz"})). Is it possible for godo to expose a saner lower-level API where we can pass these arguments directly, and no intermediary shell process is invoked?