mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
0bc4b0246d
commit
b8725f5181
1 changed files with 5 additions and 0 deletions
|
@ -17,6 +17,7 @@ package terminal
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
isatty "github.com/mattn/go-isatty"
|
isatty "github.com/mattn/go-isatty"
|
||||||
|
@ -31,6 +32,10 @@ const (
|
||||||
// IsTerminal return true if the file descriptor is terminal and the TERM
|
// IsTerminal return true if the file descriptor is terminal and the TERM
|
||||||
// environment variable isn't a dumb one.
|
// environment variable isn't a dumb one.
|
||||||
func IsTerminal(f *os.File) bool {
|
func IsTerminal(f *os.File) bool {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
fd := f.Fd()
|
fd := f.Fd()
|
||||||
return os.Getenv("TERM") != "dumb" && (isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd))
|
return os.Getenv("TERM") != "dumb" && (isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue