Skip to content

Commit

Permalink
Merge pull request #69 from ktr0731/fix-goroutine-leaks
Browse files Browse the repository at this point in the history
Fix goroutine leaks
  • Loading branch information
c-bata committed May 18, 2018
2 parents 15992ed + fd5f830 commit 2f3ee57
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func (p *Prompt) Run() {
case b := <-bufCh:
if shouldExit, e := p.feed(b); shouldExit {
p.renderer.BreakLine(p.buf)
stopReadBufCh <- struct{}{}
stopHandleSignalCh <- struct{}{}
return
} else if e != nil {
// Stop goroutine to run readBuffer function
Expand Down Expand Up @@ -224,6 +226,7 @@ func (p *Prompt) Input() string {
case b := <-bufCh:
if shouldExit, e := p.feed(b); shouldExit {
p.renderer.BreakLine(p.buf)
stopReadBufCh <- struct{}{}
return ""
} else if e != nil {
// Stop goroutine to run readBuffer function
Expand Down

0 comments on commit 2f3ee57

Please sign in to comment.