EINTR safe function to get tty size
This commit is contained in:
parent
82d0bd9364
commit
15e1f376a4
1 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue