feat: support cygwin for log writer. (#834)

This commit is contained in:
Bo-Yi Wu 2017-03-15 20:15:41 -05:00 committed by GitHub
parent b1a15020d0
commit 28b18cd1fb
3 changed files with 10 additions and 8 deletions

View File

@ -4,7 +4,7 @@ go:
- 1.6.x - 1.6.x
- 1.7.x - 1.7.x
- 1.8.x - 1.8.x
- tip - master
git: git:
depth: 3 depth: 3

View File

@ -54,7 +54,9 @@ func Logger() HandlerFunc {
func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc { func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc {
isTerm := true isTerm := true
if w, ok := out.(*os.File); !ok || !isatty.IsTerminal(w.Fd()) || disableColor { if w, ok := out.(*os.File); !ok ||
(os.Getenv("TERM") == "dumb" || (!isatty.IsTerminal(w.Fd()) && !isatty.IsCygwinTerminal(w.Fd()))) ||
disableColor {
isTerm = false isTerm = false
} }

12
vendor/vendor.json vendored
View File

@ -28,10 +28,10 @@
"revisionTime": "2015-05-31T20:46:25Z" "revisionTime": "2015-05-31T20:46:25Z"
}, },
{ {
"checksumSHA1": "xZuhljnmBysJPta/lMyYmJdujCg=", "checksumSHA1": "U6lX43KDDlNOn+Z0Yyww+ZzHfFo=",
"path": "github.com/mattn/go-isatty", "path": "github.com/mattn/go-isatty",
"revision": "30a891c33c7cde7b02a981314b4228ec99380cca", "revision": "57fdcb988a5c543893cc61bce354a6e24ab70022",
"revisionTime": "2016-11-23T14:36:37Z" "revisionTime": "2017-03-07T16:30:44Z"
}, },
{ {
"checksumSHA1": "LuFv4/jlrmFNnDb/5SCSEPAM9vU=", "checksumSHA1": "LuFv4/jlrmFNnDb/5SCSEPAM9vU=",
@ -61,10 +61,10 @@
"revisionTime": "2016-10-18T08:54:36Z" "revisionTime": "2016-10-18T08:54:36Z"
}, },
{ {
"checksumSHA1": "8SH0adTcQlA+W5dzqiQ3Hft2VXg=", "checksumSHA1": "/oZpHfYc+ZgOwYAhlvcMhmETYpw=",
"path": "golang.org/x/sys/unix", "path": "golang.org/x/sys/unix",
"revision": "478fcf54317e52ab69f40bb4c7a1520288d7f7ea", "revision": "99f16d856c9836c42d24e7ab64ea72916925fa97",
"revisionTime": "2016-12-05T15:46:50Z" "revisionTime": "2017-03-08T15:04:45Z"
}, },
{ {
"checksumSHA1": "pyAPYrymvmZl0M/Mr4yfjOQjA8I=", "checksumSHA1": "pyAPYrymvmZl0M/Mr4yfjOQjA8I=",