Skip to content

Commit

Permalink
feat: support cygwin for log writer. (gin-gonic#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy authored Mar 16, 2017
1 parent b1a1502 commit 28b18cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go:
- 1.6.x
- 1.7.x
- 1.8.x
- tip
- master

git:
depth: 3
Expand Down
4 changes: 3 additions & 1 deletion logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
12 changes: 6 additions & 6 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -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=",
Expand Down Expand Up @@ -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=",
Expand Down

0 comments on commit 28b18cd

Please sign in to comment.