Skip to content

Commit

Permalink
fix: timeout when waiting for CancelReader
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Oct 11, 2022
1 parent b9bd01b commit 8703897
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
3 changes: 1 addition & 2 deletions tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 0 additions & 5 deletions tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8703897

Please sign in to comment.