MCPcopy Create free account
hub / github.com/github/gh-aw / runGHWithSpinnerContext

Function runGHWithSpinnerContext

pkg/workflow/github_cli.go:117–141  ·  view source on GitHub ↗

runGHWithSpinnerContext executes a gh CLI command with context support, a spinner, and returns the output. This is the core implementation for all RunGH* functions.

(ctx context.Context, spinnerMessage string, combined bool, args ...string)

Source from the content-addressed store, hash-verified

115// runGHWithSpinnerContext executes a gh CLI command with context support, a spinner,
116// and returns the output. This is the core implementation for all RunGH* functions.
117func runGHWithSpinnerContext(ctx context.Context, spinnerMessage string, combined bool, args ...string) ([]byte, error) {
118 cmd := ExecGHContext(ctx, args...)
119
120 // Show spinner in interactive terminals
121 if tty.IsStderrTerminal() {
122 spinner := console.NewSpinner(spinnerMessage)
123 spinner.Start()
124 var output []byte
125 var err error
126 if combined {
127 output, err = cmd.CombinedOutput()
128 } else {
129 output, err = cmd.Output()
130 err = enrichGHError(err)
131 }
132 spinner.Stop()
133 return output, err
134 }
135
136 if combined {
137 return cmd.CombinedOutput()
138 }
139 output, err := cmd.Output()
140 return output, enrichGHError(err)
141}
142
143// RunGH executes a gh CLI command with a spinner and returns the stdout output.
144// The spinner is shown in interactive terminals to provide feedback during network operations.

Callers 2

RunGHContextFunction · 0.85
RunGHCombinedContextFunction · 0.85

Calls 6

IsStderrTerminalFunction · 0.92
NewSpinnerFunction · 0.92
enrichGHErrorFunction · 0.85
ExecGHContextFunction · 0.70
StartMethod · 0.45
StopMethod · 0.45

Tested by

no test coverage detected