diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2016-10-24 09:44:56 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2016-11-07 02:32:14 +0900 |
commit | 0c573b3dffe806253e1df2447754a5f3939a11f0 (patch) | |
tree | 1fba66a85b6ce48ff3afca18f234a0e0b6ff0822 /src/util/util.go | |
parent | 2cff00dce24df2a7e5add001423c6d8200b57c87 (diff) |
Prepare for termbox/windows build
`TAGS=termbox make` (or `go build -tags termbox`)
Diffstat (limited to 'src/util/util.go')
-rw-r--r-- | src/util/util.go | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/util/util.go b/src/util/util.go index e273882c..2a1607ce 100644 --- a/src/util/util.go +++ b/src/util/util.go @@ -1,13 +1,11 @@ package util -// #include <unistd.h> -import "C" - import ( "math" "os" - "os/exec" "time" + + "github.com/junegunn/go-isatty" ) // Max returns the largest integer @@ -95,14 +93,5 @@ func DurWithin( // IsTty returns true is stdin is a terminal func IsTty() bool { - return int(C.isatty(C.int(os.Stdin.Fd()))) != 0 -} - -// ExecCommand executes the given command with $SHELL -func ExecCommand(command string) *exec.Cmd { - shell := os.Getenv("SHELL") - if len(shell) == 0 { - shell = "sh" - } - return exec.Command(shell, "-c", command) + return isatty.IsTerminal(os.Stdin.Fd()) } |