summaryrefslogtreecommitdiff
path: root/vendor/github.com/buger/goterm/terminal_sysioctl.go
blob: 33148ede0c9609c9813bd090a25e0441e17230e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// +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
}