MCPcopy
hub / github.com/cli/cli / Run

Method Run

git/command.go:19–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19func (gc *Command) Run() error {
20 stderr := &bytes.Buffer{}
21 if gc.Cmd.Stderr == nil {
22 gc.Cmd.Stderr = stderr
23 }
24 // This is a hack in order to not break the hundreds of
25 // existing tests that rely on `run.PrepareCmd` to be invoked.
26 err := run.PrepareCmd(gc.Cmd).Run()
27 if err != nil {
28 ge := GitError{err: err, Stderr: stderr.String()}
29 var exitError *exec.ExitError
30 if errors.As(err, &exitError) {
31 ge.ExitCode = exitError.ExitCode()
32 }
33 return &ge
34 }
35 return nil
36}
37
38func (gc *Command) Output() ([]byte, error) {
39 gc.Stdout = nil

Callers 1

executeCmdsFunction · 0.95

Calls 3

RunMethod · 0.65
ExitCodeMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected