mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 09:57:51 +08:00
16 lines
273 B
Go
16 lines
273 B
Go
// +build !windows,!plan9
|
|
|
|
package sys
|
|
|
|
import (
|
|
"os"
|
|
"unsafe"
|
|
)
|
|
|
|
// IsATTY returns true if the given file is a terminal.
|
|
func IsATTY(file *os.File) bool {
|
|
var term Termios
|
|
err := Ioctl(int(file.Fd()), getAttrIOCTL, uintptr(unsafe.Pointer(&term)))
|
|
return err == nil
|
|
}
|