Skip to content

Commit

Permalink
Add missing function for plan9
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Oct 9, 2019
1 parent 62f7128 commit 88ba11c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/mattn/go-isatty

require golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
require golang.org/x/sys v0.0.0-20191008105621-543471e840be

go 1.14

This comment has been minimized.

Copy link
@savely-krasovsky

savely-krasovsky Oct 9, 2019

When Go 1.14 was released? 🤔

This comment has been minimized.

Copy link
@mattn

mattn Oct 9, 2019

Author Owner

Ah, sorry.

2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
7 changes: 7 additions & 0 deletions isatty_plan9.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ import (
"syscall"
)

// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd uintptr) bool {
path, err := syscall.Fd2path(fd)
if err != nil {
return false
}
return path == "/dev/cons" || path == "/mnt/term/dev/cons"
}

// IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
}

0 comments on commit 88ba11c

Please sign in to comment.