Skip to content
Myr

fix: timeout when waiting for CancelReader

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes #524.

authored by Christian Muehlhaeuser · committed by Christian Muehlhaeuser · parent b9bd01b · Browse files · 2 files+1 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+1 added−7 removed

  • other:+1 added−7 removed

2 files+1 added−7 removed

modified:tea.go+1 added-2 removed
444 unmodified lines
445 if err := p.initCancelReader(); err != nil {446 return model, err447 }448 defer p.cancelReader.Close() //nolint:errcheck449 handlers.add(p.readLoopDone)449 }450451 // Handle resize events.452 handlers.add(p.handleResize())
91 unmodified lines
544// ReleaseTerminal restores the original terminal state and cancels the input545// reader. You can return control to the Program with RestoreTerminal.546func (p *Program) ReleaseTerminal() error {547 p.ignoreSignals = true549 p.cancelInput()548 p.cancelReader.Cancel()549 p.waitForReadLoop()550551 p.altScreenWasActive = p.renderer.altScreen()552 if p.renderer.altScreen() {
71 unmodified lines
modified:tty.go-5 removed
77 unmodified lines
78 }79 }80}8182// cancelInput cancels the input reader.83func (p *Program) cancelInput() {84 p.cancelReader.Cancel()85}8682// waitForReadLoop waits for the cancelReader to finish its read loop.83func (p *Program) waitForReadLoop() {84 select {85 case <-p.readLoopDone:
6 unmodified lines