mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
golint: docs
This commit is contained in:
parent
c2e61912f2
commit
ea41547c16
|
|
@ -7,15 +7,18 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
// IsTty checks if the given fd is a tty
|
||||
func IsTty(fd uintptr) bool {
|
||||
var termios syscall.Termios
|
||||
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, uintptr(syscall.TIOCGETA), uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
|
||||
return err == 0
|
||||
}
|
||||
|
||||
// TtyReady checks if the tty is ready to go
|
||||
func TtyReady() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TtyTerm restores any state, if necessary
|
||||
func TtyTerm() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,15 +7,18 @@ import (
|
|||
"unsafe"
|
||||
)
|
||||
|
||||
// IsTty checks if the given fd is a tty
|
||||
func IsTty(fd uintptr) bool {
|
||||
var termios syscall.Termios
|
||||
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, uintptr(syscall.TCGETS), uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
|
||||
return err == 0
|
||||
}
|
||||
|
||||
// TtyReady checks if the tty is ready to go
|
||||
func TtyReady() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TtyTerm restores any state, if necessary
|
||||
func TtyTerm() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ func setStdHandle(stdhandle int32, handle syscall.Handle) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// IsTty checks if the given fd is a tty
|
||||
func IsTty(fd uintptr) bool {
|
||||
f := syscall.MustLoadDLL("kernel32.dll").MustFindProc("GetConsoleMode")
|
||||
var st uint32
|
||||
|
|
@ -38,6 +39,7 @@ func IsTty(fd uintptr) bool {
|
|||
var stdout = os.Stdout
|
||||
var stdin = os.Stdin
|
||||
|
||||
// TtyReady checks if the tty is ready to go
|
||||
func TtyReady() error {
|
||||
var err error
|
||||
_stdin, err := os.Open("CONIN$")
|
||||
|
|
@ -69,6 +71,7 @@ func TtyReady() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// TtyTerm restores any state, if necessary
|
||||
func TtyTerm() {
|
||||
os.Stdin = stdin
|
||||
syscall.Stdin = syscall.Handle(os.Stdin.Fd())
|
||||
|
|
|
|||
Loading…
Reference in a new issue