Browse Source

Merge branch 'master' of git://github.com/mattn/go-isatty

Yasuhiro Matsumoto 10 years ago
parent
commit
3a115632dc
6 changed files with 28 additions and 0 deletions
  1. 15 0
      _example/example.go
  2. 9 0
      isatty_appengine.go
  3. 1 0
      isatty_bsd.go
  4. 1 0
      isatty_linux.go
  5. 1 0
      isatty_solaris.go
  6. 1 0
      isatty_windows.go

+ 15 - 0
_example/example.go

@@ -0,0 +1,15 @@
+package main
+
+import (
+	"fmt"
+	"github.com/mattn/go-isatty"
+	"os"
+)
+
+func main() {
+	if isatty.IsTerminal(int(os.Stdout.Fd())) {
+		fmt.Println("Is Terminal")
+	} else {
+		fmt.Println("Is Not Terminal")
+	}
+}

+ 9 - 0
isatty_appengine.go

@@ -0,0 +1,9 @@
+// +build appengine
+
+package isatty
+
+// IsTerminal returns true if the file descriptor is terminal which
+// is always false on on appengine classic which is a sandboxed PaaS.
+func IsTerminal(fd uintptr) bool {
+	return false
+}

+ 1 - 0
isatty_bsd.go

@@ -1,4 +1,5 @@
 // +build darwin freebsd openbsd netbsd
 // +build darwin freebsd openbsd netbsd
+// +build !appengine
 
 
 package isatty
 package isatty
 
 

+ 1 - 0
isatty_linux.go

@@ -1,4 +1,5 @@
 // +build linux
 // +build linux
+// +build !appengine
 
 
 package isatty
 package isatty
 
 

+ 1 - 0
isatty_solaris.go

@@ -1,4 +1,5 @@
 // +build solaris
 // +build solaris
+// +build !appengine
 
 
 package isatty
 package isatty
 
 

+ 1 - 0
isatty_windows.go

@@ -1,4 +1,5 @@
 // +build windows
 // +build windows
+// +build !appengine
 
 
 package isatty
 package isatty