MCPcopy Create free account
hub / github.com/cli/cli / Run

Method Run

git/command.go:17–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 2

executeCmdsFunction · 0.95

Calls 3

RunMethod · 0.65
StringMethod · 0.65
ExitCodeMethod · 0.65

Tested by 1