Skip to content

Instantly share code, notes, and snippets.

@qdm12
Created February 9, 2020 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qdm12/8ebf2edd6622895d2afa98fc7d797f66 to your computer and use it in GitHub Desktop.
Save qdm12/8ebf2edd6622895d2afa98fc7d797f66 to your computer and use it in GitHub Desktop.
func (c *commander) Start(name string, arg ...string) (stdoutPipe, stderrPipe io.ReadCloser, waitFn func() error, err error) {
cmd := c.execCommand(name, arg...)
stdout, err := cmd.StdoutPipe()
if err != nil {
return nil, nil, nil, err
}
stderr, err := cmd.StderrPipe()
if err != nil {
return nil, nil, nil, err
}
if err := cmd.Start(); err != nil {
return nil, nil, nil, err
}
return stdout, stderr, cmd.Wait, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment