EINTR safe function to get tty size

This commit is contained in:
Kovid Goyal 2022-08-21 11:37:54 +05:30
parent 82d0bd9364
commit 15e1f376a4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -302,3 +302,12 @@ func (self *Term) WriteFromReader(r Reader, read_timeout time.Duration, write_ti
buf = buf[:0]
}
}
func (self *Term) GetSize() (*unix.Winsize, error) {
for {
sz, err := unix.IoctlGetWinsize(self.fd, unix.TIOCGWINSZ)
if err != unix.EINTR {
return sz, err
}
}
}