Output executes a git command and returns stdout only.
(ctx context.Context, repoDir string, args ...string)
| 55 | |
| 56 | // Output executes a git command and returns stdout only. |
| 57 | func (r *Runner) Output(ctx context.Context, repoDir string, args ...string) ([]byte, error) { |
| 58 | if err := r.acquire(ctx); err != nil { |
| 59 | return nil, err |
| 60 | } |
| 61 | defer r.release() |
| 62 | |
| 63 | cmd := exec.CommandContext(ctx, "git", args...) |
| 64 | cmd.Dir = repoDir |
| 65 | return cmd.Output() |
| 66 | } |
| 67 | |
| 68 | // RunSplit executes a git command and returns stdout and stderr separately. |
| 69 | func (r *Runner) RunSplit(ctx context.Context, repoDir string, args ...string) (string, string, error) { |