Skip to content

Commit 7b513a9

Browse files
authored
Merge pull request #49 from tklauser/use-x-sys
Use golang.org/x/sys/unix for android and *BSD
2 parents fb38f00 + 6ede958 commit 7b513a9

File tree

4 files changed

+3
-37
lines changed

4 files changed

+3
-37
lines changed

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
2-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3-
golang.org/x/sys v0.0.0-20200107162124-548cf772de50 h1:YvQ10rzcqWXLlJZ3XCUoO25savxmscf4+SC+ZqiCHhA=
4-
golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
51
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
62
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

isatty_android.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

isatty_bsd.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,12 @@
33

44
package isatty
55

6-
import (
7-
"syscall"
8-
"unsafe"
9-
)
10-
11-
const ioctlReadTermios = syscall.TIOCGETA
6+
import "golang.org/x/sys/unix"
127

138
// IsTerminal return true if the file descriptor is terminal.
149
func IsTerminal(fd uintptr) bool {
15-
var termios syscall.Termios
16-
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
17-
return err == 0
10+
_, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA)
11+
return err == nil
1812
}
1913

2014
// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2

isatty_tcgets.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// +build linux aix
22
// +build !appengine
3-
// +build !android
43

54
package isatty
65

0 commit comments

Comments
 (0)