fixes #480 EventError fired after suspended Screen resumes (#484)

This commit is contained in:
Garrett D'Amore 2021-09-04 17:28:22 -07:00 committed by GitHub
parent 4e564d2402
commit f057f0a857
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -1547,7 +1547,12 @@ func (t *tScreen) inputLoop(stopQ chan struct{}) {
switch e { switch e {
case nil: case nil:
default: default:
_ = t.PostEvent(NewEventError(e)) t.Lock()
running := t.running
t.Unlock()
if running {
_ = t.PostEvent(NewEventError(e))
}
return return
} }
if n > 0 { if n > 0 {

View File

@ -72,7 +72,7 @@ func (tty *devTty) Start() error {
if tty.f, err = os.OpenFile(tty.dev, os.O_RDWR, 0); err != nil { if tty.f, err = os.OpenFile(tty.dev, os.O_RDWR, 0); err != nil {
return err return err
} }
tty.fd = int(tty.of.Fd()) tty.fd = int(tty.f.Fd())
if !term.IsTerminal(tty.fd) { if !term.IsTerminal(tty.fd) {
return errors.New("device is not a terminal") return errors.New("device is not a terminal")