1 Star 1 Fork 0

hh / etcd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ts_x.go 945 Bytes
一键复制 编辑 原始数据 按行查看 历史
Gyu-Ho Lee 提交于 2015-12-21 22:20 . Godeps: add missing dependencies
// +build !windows
// Copyright 2014 Oleku Konko All rights reserved.
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
// This module is a Terminal API for the Go Programming Language.
// The protocols were written in pure Go and works on windows and unix systems
package ts
import (
"syscall"
"unsafe"
)
// Get Windows Size
func GetSize() (ws Size, err error) {
_, _, ec := syscall.Syscall(syscall.SYS_IOCTL,
uintptr(syscall.Stdout),
uintptr(TIOCGWINSZ),
uintptr(unsafe.Pointer(&ws)))
err = getError(ec)
if TIOCGWINSZ == 0 && err != nil {
ws = Size{80, 25, 0, 0}
}
return ws, err
}
func getError(ec interface{}) (err error) {
switch v := ec.(type) {
case syscall.Errno: // Some implementation return syscall.Errno number
if v != 0 {
err = syscall.Errno(v)
}
case error: // Some implementation return error
err = ec.(error)
default:
err = nil
}
return
}
1
https://gitee.com/w1229748769/etcd.git
git@gitee.com:w1229748769/etcd.git
w1229748769
etcd
etcd
v2.3.6

搜索帮助

53164aa7 5694891 3bd8fe86 5694891