Skip to content

Commit

Permalink
prompt: Fix term restore by closing fd only AFTER restoring
Browse files Browse the repository at this point in the history
fbshipit-source-id: 68880c5
  • Loading branch information
joeycumines committed Aug 14, 2023
1 parent 2cc56e1 commit e1dbe10
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions reader_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ func (t *PosixReader) Open() error {

// Close should be called after stopping input
func (t *PosixReader) Close() error {
if err := syscall.Close(t.fd); err != nil {
return err
}
if err := term.Restore(); err != nil {
_ = syscall.Close(t.fd)
return err
}
return nil
return syscall.Close(t.fd)
}

// Read returns byte array.
Expand Down

0 comments on commit e1dbe10

Please sign in to comment.