summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-05-15 01:39:56 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-05-15 01:39:56 +0200
commit5bf6ad9fa3a51e57ea7c0f9abb9d31e83cb140cf (patch)
treea7b5347a50dc6c2f4cdc6f4eb52e71a4c3232652
parent02b78d3f94225ab1b204191d0fb199125787f31d (diff)
downloadNim-5bf6ad9fa3a51e57ea7c0f9abb9d31e83cb140cf.tar.gz
make tests green on Unix
-rw-r--r--compiler/msgs.nim4
-rw-r--r--compiler/options.nim7
2 files changed, 6 insertions, 5 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 774a8b83c..533d3a57f 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -647,7 +647,3 @@ proc listHints*(conf: ConfigRef) =
       if hint in conf.notes: "x" else: " ",
       configuration.HintsToStr[ord(hint) - ord(hintMin)]
     ])
-
-# enable colors by default on terminals
-#if terminal.isatty(stderr):
-#  incl(gGlobalOptions, optUseColors)
diff --git a/compiler/options.nim b/compiler/options.nim
index 56c3dcf0b..2027897fa 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -10,6 +10,8 @@
 import
   os, strutils, strtabs, osproc, sets, configuration, platform
 
+from terminal import isatty
+
 const
   hasTinyCBackend* = defined(tinyc)
   useEffectSystem* = true
@@ -182,7 +184,7 @@ const
     optBoundsCheck, optOverflowCheck, optAssert, optWarns,
     optHints, optStackTrace, optLineTrace,
     optPatterns, optNilCheck, optMoveCheck}
-  DefaultGlobalOptions* = {optThreadAnalysis, optUseColors}
+  DefaultGlobalOptions* = {optThreadAnalysis}
 
 template newPackageCache*(): untyped =
   newStringTable(when FileSystemCaseSensitive:
@@ -221,6 +223,9 @@ proc newConfigRef*(): ConfigRef =
     implicitIncludes: @[], # modules that are to be implicitly included
     docSeeSrcUrl: ""
   )
+  # enable colors by default on terminals
+  if terminal.isatty(stderr):
+    incl(result.globalOptions, optUseColors)
 
 proc newPartialConfigRef*(): ConfigRef =
   ## create a new ConfigRef that is only good enough for error reporting.