aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/buger/goterm/terminal_sysioctl.go
blob: 5a61cd52bafe7ef4d4ecb7007ce9f4f06d082eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// +build !windows,!plan9,!solaris

package goterm

import (
	"os"
	"golang.org/x/sys/unix"
)

func getWinsize() (*unix.Winsize, error) {

	ws, err := unix.IoctlGetWinsize(int(os.Stdout.Fd()), unix.TIOCGWINSZ)
	if err != nil {
		return nil, os.NewSyscallError("GetWinsize", err)
	}

	return ws, nil
}