From fd5f8304d0d2fa359c18946b6f208fcbf09ee659 Mon Sep 17 00:00:00 2001 From: ktr0731 Date: Sun, 13 May 2018 19:34:13 +0900 Subject: [PATCH] Fix goroutine leaks --- prompt.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prompt.go b/prompt.go index 008799c..cedacea 100644 --- a/prompt.go +++ b/prompt.go @@ -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 @@ -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