github.com/linapex/ethereum-dpos-chinese@v0.0.0-20190316121959-b78b3a4a1ece/log/term/terminal_notwindows.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 12:09:41</date> 10 //</624342647263203328> 11 12 //基于ssh/终端: 13 //版权所有2011 Go作者。版权所有。 14 //此源代码的使用受BSD样式的控制 15 //可以在许可文件中找到的许可证。 16 17 //+建立Linux,!appengine darwin freebsd openbsd netbsd 18 19 package term 20 21 import ( 22 "syscall" 23 "unsafe" 24 ) 25 26 //如果给定的文件描述符是终端,则istty返回true。 27 func IsTty(fd uintptr) bool { 28 var termios Termios 29 _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) 30 return err == 0 31 } 32