blob: cdb87a49d7913bdf6139864954efb72d39946fca (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package testgit
import (
"io"
"os/exec"
"testing"
)
func (repo *Repo) Command(
tb testing.TB,
command string,
args ...string,
) *exec.Cmd {
tb.Helper()
cmd := exec.CommandContext(tb.Context(), command, args...)
cmd.Dir = repo.path
cmd.Env = repo.env
return cmd
}
func (repo *Repo) Run(
tb testing.TB,
stdin io.Reader,
command string,
args ...string,
) (stdout []byte, err error) {
tb.Helper()
cmd := repo.Command(tb, command, args...)
cmd.Stdin = stdin
return cmd.Output()
}
|