Rename to GitHub (#3)

* circle

* Rename to github and fn->cli

*  Rename to github and fn->cli
This commit is contained in:
Travis Reeder
2017-07-26 10:50:19 -07:00
committed by GitHub
parent 27b665422d
commit 48e3781d5e
9861 changed files with 213 additions and 188 deletions

25
cli/run_windows.go Normal file
View File

@@ -0,0 +1,25 @@
// +build windows
package main
import (
"io"
"os"
"syscall"
"unsafe"
)
func stdin() io.Reader {
if isTerminal(int(os.Stdin.Fd())) {
return nil
}
return os.Stdin
}
func isTerminal(fd int) bool {
kernel32 := syscall.NewLazyDLL("kernel32.dll")
procGetConsoleMode := kernel32.NewProc("GetConsoleMode")
var st uint32
r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
return r != 0 && e == 0
}