From 9bcfc026a2feb9b07055201922877242d8485f53 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 20 Oct 2022 11:47:12 +0200 Subject: [PATCH] fix: restore Windows console mode on shutdown The deferred Close call on our input reader caused the console mode to be reset twice, and the incorrect, inner mode was applied last. --- tea.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tea.go b/tea.go index d6a19d5..995299e 100644 --- a/tea.go +++ b/tea.go @@ -442,7 +442,6 @@ func (p *Program) Run() (Model, error) { if err := p.initCancelReader(); err != nil { return model, err } - defer p.cancelReader.Close() //nolint:errcheck } // Handle resize events. @@ -468,6 +467,7 @@ func (p *Program) Run() (Model, error) { if p.cancelReader.Cancel() { p.waitForReadLoop() } + _ = p.cancelReader.Close() // Wait for all handlers to finish. handlers.shutdown()