EINTR safe function to get tty size
This commit is contained in:
parent
82d0bd9364
commit
15e1f376a4
@ -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…
x
Reference in New Issue
Block a user