forked from Mirrors/bubbletea
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.
This commit is contained in:
parent
a7067fbfa2
commit
9bcfc026a2
2
tea.go
2
tea.go
|
@ -442,7 +442,6 @@ func (p *Program) Run() (Model, error) {
|
||||||
if err := p.initCancelReader(); err != nil {
|
if err := p.initCancelReader(); err != nil {
|
||||||
return model, err
|
return model, err
|
||||||
}
|
}
|
||||||
defer p.cancelReader.Close() //nolint:errcheck
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle resize events.
|
// Handle resize events.
|
||||||
|
@ -468,6 +467,7 @@ func (p *Program) Run() (Model, error) {
|
||||||
if p.cancelReader.Cancel() {
|
if p.cancelReader.Cancel() {
|
||||||
p.waitForReadLoop()
|
p.waitForReadLoop()
|
||||||
}
|
}
|
||||||
|
_ = p.cancelReader.Close()
|
||||||
|
|
||||||
// Wait for all handlers to finish.
|
// Wait for all handlers to finish.
|
||||||
handlers.shutdown()
|
handlers.shutdown()
|
||||||
|
|
Loading…
Reference in New Issue