From e1dbe10bc53b917b16d09f44aabf02813293387d Mon Sep 17 00:00:00 2001 From: Joseph Cumines Date: Tue, 15 Aug 2023 09:46:49 +1000 Subject: [PATCH] prompt: Fix term restore by closing fd only AFTER restoring fbshipit-source-id: 68880c5 --- reader_posix.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/reader_posix.go b/reader_posix.go index cb209b25..85a62a63 100644 --- a/reader_posix.go +++ b/reader_posix.go @@ -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.