mattn 11 年之前
父節點
當前提交
88a5f3c00f
共有 3 個文件被更改,包括 3 次插入0 次删除
  1. 1 0
      isatty_darwin.go
  2. 1 0
      isatty_linux.go
  3. 1 0
      isatty_windows.go

+ 1 - 0
isatty_darwin.go

@@ -9,6 +9,7 @@ import (
 
 const ioctlReadTermios = syscall.TIOCGETA
 
+// IsTerminal return true if the file descriptor is terminal.
 func IsTerminal(fd uintptr) bool {
 	var termios syscall.Termios
 	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)

+ 1 - 0
isatty_linux.go

@@ -9,6 +9,7 @@ import (
 
 const ioctlReadTermios = syscall.TCGETS
 
+// IsTerminal return true if the file descriptor is terminal.
 func IsTerminal(fd uintptr) bool {
 	var termios syscall.Termios
 	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)

+ 1 - 0
isatty_windows.go

@@ -10,6 +10,7 @@ import (
 var kernel32 = syscall.NewLazyDLL("kernel32.dll")
 var procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
 
+// IsTerminal return true if the file descriptor is terminal.
 func IsTerminal(fd uintptr) bool {
 	var st uint32
 	r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0)