|
@@ -21,11 +21,19 @@ type Winsize struct {
|
|
|
func GetWinsize(fd uintptr) (*Winsize, error) {
|
|
|
ws := &Winsize{}
|
|
|
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(ws)))
|
|
|
+ // Skipp errno = 0
|
|
|
+ if err == 0 {
|
|
|
+ return ws, nil
|
|
|
+ }
|
|
|
return ws, err
|
|
|
}
|
|
|
|
|
|
func SetWinsize(fd uintptr, ws *Winsize) error {
|
|
|
_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCSWINSZ), uintptr(unsafe.Pointer(ws)))
|
|
|
+ // Skipp errno = 0
|
|
|
+ if err == 0 {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
return err
|
|
|
}
|
|
|
|