mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Merge pull request #79 from moitias/master
handle stderr stat() throwing an error on Windows
This commit is contained in:
@@ -135,8 +135,9 @@ func configureLogger(s *server.Server, opts *server.Options) {
|
||||
} else {
|
||||
colors := true
|
||||
// Check to see if stderr is being redirected and if so turn off color
|
||||
stat, _ := os.Stderr.Stat()
|
||||
if (stat.Mode() & os.ModeCharDevice) == 0 {
|
||||
// Also turn off colors if we're running on Windows where os.Stderr.Stat() returns an invalid handle-error
|
||||
stat, err := os.Stderr.Stat()
|
||||
if err != nil || (stat.Mode()&os.ModeCharDevice) == 0 {
|
||||
colors = false
|
||||
}
|
||||
log = logger.NewStdLogger(opts.Logtime, opts.Debug, opts.Trace, colors, true)
|
||||
|
||||
Reference in New Issue
Block a user