MCPcopy Index your code
hub / github.com/coder/agentapi / runSpinner

Function runSpinner

e2e/echo.go:193–215  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

191}
192
193func runSpinner(ctx context.Context) <-chan struct{} {
194 done := make(chan struct{})
195 go func() {
196 defer close(done)
197 spinnerChars := []string{"|", "/", "-", "\\"}
198 ticker := time.NewTicker(200 * time.Millisecond)
199 defer ticker.Stop()
200 i := 0
201
202 for {
203 select {
204 case <-ticker.C:
205 fmt.Printf("\rThinking %s", spinnerChars[i%len(spinnerChars)])
206 i++
207 case <-ctx.Done():
208 // Clear spinner on cancellation
209 fmt.Print("\r" + strings.Repeat(" ", 20) + "\r")
210 return
211 }
212 }
213 }()
214 return done
215}

Callers 1

runEchoAgentFunction · 0.85

Calls 1

StopMethod · 0.45

Tested by

no test coverage detected