func IsTerminal(fd uintptr) bool {
	var termios Termios
	return tcget(fd, &termios) == 0
}
IsTerminal returns true if the given file descriptor is a terminal.
package term
import (
	"errors"
	"io"
	"os"
	"os/signal"
	"syscall"
	"unsafe"
)
var (
	ErrInvalidState = errors.New("Invalid terminal state")
)
type State struct {
	termios Termios
}
type Winsize struct {
	Height uint16
	Width  uint16
	x      uint16
	y      uint16
}
func StdStreams() (stdIn io.ReadCloser, stdOut, stdErr io.Writer) {
	return os.Stdin, os.Stdout, os.Stderr
}
func GetFdInfo(in interface{}) (uintptr, bool) {
	var inFd uintptr
	var isTerminalIn bool
	if file, ok := in.(*os.File); ok {
		inFd = file.Fd()
		isTerminalIn = IsTerminal(inFd)
	}
	return inFd, isTerminalIn
}
func GetWinsize(fd uintptr) (*Winsize, error) {
	ws := &Winsize{}
	_, _, err := syscall.Syscall(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCGWINSZ), uintptr(unsafe.Pointer(ws)))
	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)))
	if err == 0 {
		return nil
	}
	return err
}