Merge pull request #594 from sirupsen/sys_unix

Use x/sys/unix instead of syscall
This commit is contained in:
Damien Mathieu
2017-07-26 14:47:05 +02:00
committed by GitHub
5 changed files with 17 additions and 13 deletions
+3 -2
View File
@@ -11,8 +11,9 @@ package logrus
import (
"io"
"os"
"syscall"
"unsafe"
"golang.org/x/sys/unix"
)
// IsTerminal returns true if stderr's file descriptor is a terminal.
@@ -20,7 +21,7 @@ func IsTerminal(f io.Writer) bool {
var termios Termios
switch v := f.(type) {
case *os.File:
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
_, _, err := unix.Syscall6(unix.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
return err == 0
default:
return false