mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* fn: add test framework * fn: make routes creation smarter * fn: add testframework examples * fn: remove unnecessary dependency * fn: update doc * fn: fix consistenty between runff, runlocaltest and runremotetest
26 lines
415 B
Go
26 lines
415 B
Go
// +build windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
"strings"
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
func getStdin() io.Reader {
|
|
var stdin io.Reader = os.Stdin
|
|
if isTerminal(int(os.Stdin.Fd())) {
|
|
stdin = strings.NewReader("")
|
|
}
|
|
return stdin
|
|
}
|
|
|
|
func isTerminal(fd int) bool {
|
|
var st uint32
|
|
r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
|
|
return r != 0 && e == 0
|
|
}
|