github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum@v0.0.0-20190121132951-92cc4225ed8e/log/term/terminal_notwindows.go (about)

     1  
     2  //此源码被清华学神尹成大魔王专业翻译分析并修改
     3  //尹成QQ77025077
     4  //尹成微信18510341407
     5  //尹成所在QQ群721929980
     6  //尹成邮箱 yinc13@mails.tsinghua.edu.cn
     7  //尹成毕业于清华大学,微软区块链领域全球最有价值专家
     8  //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620
     9  //基于ssh/终端:
    10  //版权所有2011 Go作者。版权所有。
    11  //此源代码的使用受BSD样式的控制
    12  //可以在许可文件中找到的许可证。
    13  
    14  //+建立Linux,!appengine darwin freebsd openbsd netbsd
    15  
    16  package term
    17  
    18  import (
    19  	"syscall"
    20  	"unsafe"
    21  )
    22  
    23  //如果给定的文件描述符是终端,则istty返回true。
    24  func IsTty(fd uintptr) bool {
    25  	var termios Termios
    26  	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
    27  	return err == 0
    28  }