From 28b18cd1fb827dde65a2094d7e57418364eac16c Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Wed, 15 Mar 2017 20:15:41 -0500 Subject: [PATCH] feat: support cygwin for log writer. (#834) --- .travis.yml | 2 +- logger.go | 4 +++- vendor/vendor.json | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9fb59940..2f9385e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ go: - 1.6.x - 1.7.x - 1.8.x - - tip + - master git: depth: 3 diff --git a/logger.go b/logger.go index c7cbfe1f..dc6f1415 100644 --- a/logger.go +++ b/logger.go @@ -54,7 +54,9 @@ func Logger() HandlerFunc { func LoggerWithWriter(out io.Writer, notlogged ...string) HandlerFunc { 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 } diff --git a/vendor/vendor.json b/vendor/vendor.json index 00115c50..2bc5e194 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -28,10 +28,10 @@ "revisionTime": "2015-05-31T20:46:25Z" }, { - "checksumSHA1": "xZuhljnmBysJPta/lMyYmJdujCg=", + "checksumSHA1": "U6lX43KDDlNOn+Z0Yyww+ZzHfFo=", "path": "github.com/mattn/go-isatty", - "revision": "30a891c33c7cde7b02a981314b4228ec99380cca", - "revisionTime": "2016-11-23T14:36:37Z" + "revision": "57fdcb988a5c543893cc61bce354a6e24ab70022", + "revisionTime": "2017-03-07T16:30:44Z" }, { "checksumSHA1": "LuFv4/jlrmFNnDb/5SCSEPAM9vU=", @@ -61,10 +61,10 @@ "revisionTime": "2016-10-18T08:54:36Z" }, { - "checksumSHA1": "8SH0adTcQlA+W5dzqiQ3Hft2VXg=", + "checksumSHA1": "/oZpHfYc+ZgOwYAhlvcMhmETYpw=", "path": "golang.org/x/sys/unix", - "revision": "478fcf54317e52ab69f40bb4c7a1520288d7f7ea", - "revisionTime": "2016-12-05T15:46:50Z" + "revision": "99f16d856c9836c42d24e7ab64ea72916925fa97", + "revisionTime": "2017-03-08T15:04:45Z" }, { "checksumSHA1": "pyAPYrymvmZl0M/Mr4yfjOQjA8I=",