Skip to content

Commit

Permalink
fix: renderer only stops once
Browse files Browse the repository at this point in the history
Ensure the tea renderer can be stopped and restarted more than once.
  • Loading branch information
muesli committed Mar 6, 2023
1 parent 32e3027 commit 2d7491b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions standard_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ func (r *standardRenderer) start() {
if r.ticker == nil {
r.ticker = time.NewTicker(r.framerate)
}

// Since the renderer can be restarted after a stop, we need to reset
// the done channel and its corresponding sync.Once.
r.once = sync.Once{}
r.done = make(chan struct{})

go r.listen()
}

Expand Down

0 comments on commit 2d7491b

Please sign in to comment.