Skip to content

Commit

Permalink
Merge pull request #3 from dnmurray/bug/stop-race-condition
Browse files Browse the repository at this point in the history
Fix race condition when stopping before spinner fully built
  • Loading branch information
slok authored Jun 18, 2018
2 parents c83bbea + 7897291 commit c6cc8e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spinner.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ func (s *Spinner) StartWithSpeed(message string, speed time.Duration) error {

s.message = message
s.createFrames()
s.ticker = time.NewTicker(speed)
// Start the animation in background
go func() {
s.running = true
s.ticker = time.NewTicker(speed)

for range s.ticker.C {
s.Render()
Expand Down

0 comments on commit c6cc8e2

Please sign in to comment.