blob: 341b635cf594959d499de9b37d5af42a367b1d34 (
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() //nolint:wrapcheck
}
|