Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how should I use os/exec in a task? #47

Open
jameshfisher opened this issue May 31, 2016 · 2 comments
Open

how should I use os/exec in a task? #47

jameshfisher opened this issue May 31, 2016 · 2 comments

Comments

@jameshfisher
Copy link

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?

@mgutz
Copy link

mgutz commented May 31, 2016

@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, " "))

@jameshfisher
Copy link
Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants