Merge pull request #69 from ktr0731/fix-goroutine-leaks
Fix goroutine leaks
This commit is contained in:
commit
2f3ee57cf5
@ -65,6 +65,8 @@ func (p *Prompt) Run() {
|
|||||||
case b := <-bufCh:
|
case b := <-bufCh:
|
||||||
if shouldExit, e := p.feed(b); shouldExit {
|
if shouldExit, e := p.feed(b); shouldExit {
|
||||||
p.renderer.BreakLine(p.buf)
|
p.renderer.BreakLine(p.buf)
|
||||||
|
stopReadBufCh <- struct{}{}
|
||||||
|
stopHandleSignalCh <- struct{}{}
|
||||||
return
|
return
|
||||||
} else if e != nil {
|
} else if e != nil {
|
||||||
// Stop goroutine to run readBuffer function
|
// Stop goroutine to run readBuffer function
|
||||||
@ -224,6 +226,7 @@ func (p *Prompt) Input() string {
|
|||||||
case b := <-bufCh:
|
case b := <-bufCh:
|
||||||
if shouldExit, e := p.feed(b); shouldExit {
|
if shouldExit, e := p.feed(b); shouldExit {
|
||||||
p.renderer.BreakLine(p.buf)
|
p.renderer.BreakLine(p.buf)
|
||||||
|
stopReadBufCh <- struct{}{}
|
||||||
return ""
|
return ""
|
||||||
} else if e != nil {
|
} else if e != nil {
|
||||||
// Stop goroutine to run readBuffer function
|
// Stop goroutine to run readBuffer function
|
||||||
|
Loading…
Reference in New Issue
Block a user