From 8703897aad6c85216ae76b5abab1b2a147e21d2d Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 11 Oct 2022 09:26:34 +0200 Subject: [PATCH] fix: timeout when waiting for CancelReader Fixes #524. --- tea.go | 3 +-- tty.go | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/tea.go b/tea.go index c0251f9..1af5214 100644 --- a/tea.go +++ b/tea.go @@ -446,7 +446,6 @@ func (p *Program) Run() (Model, error) { return model, err } defer p.cancelReader.Close() //nolint:errcheck - handlers.add(p.readLoopDone) } // Handle resize events. @@ -546,7 +545,7 @@ func (p *Program) shutdown(kill bool) { // reader. You can return control to the Program with RestoreTerminal. func (p *Program) ReleaseTerminal() error { p.ignoreSignals = true - p.cancelInput() + p.cancelReader.Cancel() p.waitForReadLoop() p.altScreenWasActive = p.renderer.altScreen() diff --git a/tty.go b/tty.go index 85725c2..a38aa61 100644 --- a/tty.go +++ b/tty.go @@ -79,11 +79,6 @@ func (p *Program) readLoop() { } } -// cancelInput cancels the input reader. -func (p *Program) cancelInput() { - p.cancelReader.Cancel() -} - // waitForReadLoop waits for the cancelReader to finish its read loop. func (p *Program) waitForReadLoop() { select {