Skip to content

Commit

Permalink
Merge pull request #49 from tklauser/use-x-sys
Browse files Browse the repository at this point in the history
Use golang.org/x/sys/unix for android and *BSD
  • Loading branch information
mattn committed Jan 21, 2020
2 parents fb38f00 + 6ede958 commit 7b513a9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 37 deletions.
4 changes: 0 additions & 4 deletions go.sum
@@ -1,6 +1,2 @@
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200107162124-548cf772de50 h1:YvQ10rzcqWXLlJZ3XCUoO25savxmscf4+SC+ZqiCHhA=
golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
23 changes: 0 additions & 23 deletions isatty_android.go

This file was deleted.

12 changes: 3 additions & 9 deletions isatty_bsd.go
Expand Up @@ -3,18 +3,12 @@

package isatty

import (
"syscall"
"unsafe"
)

const ioctlReadTermios = syscall.TIOCGETA
import "golang.org/x/sys/unix"

// 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)
return err == 0
_, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA)
return err == nil
}

// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
Expand Down
1 change: 0 additions & 1 deletion isatty_tcgets.go
@@ -1,6 +1,5 @@
// +build linux aix
// +build !appengine
// +build !android

package isatty

Expand Down

0 comments on commit 7b513a9

Please sign in to comment.