hgext/color.py
changeset 30638 1c5cbf28f007
parent 30387 ca74c076710e
child 30640 7a3e67bfa417
--- a/hgext/color.py	Sun Dec 18 02:06:00 2016 +0530
+++ b/hgext/color.py	Sun Dec 18 02:08:59 2016 +0530
@@ -171,6 +171,7 @@
     cmdutil,
     commands,
     dispatch,
+    encoding,
     extensions,
     subrepo,
     ui as uimod,
@@ -245,7 +246,8 @@
     if not always and not auto:
         return None
 
-    formatted = always or (os.environ.get('TERM') != 'dumb' and ui.formatted())
+    formatted = (always or (encoding.environ.get('TERM') != 'dumb'
+                 and ui.formatted()))
 
     mode = ui.config('color', 'mode', 'auto')
 
@@ -256,7 +258,7 @@
     realmode = mode
     if mode == 'auto':
         if os.name == 'nt':
-            term = os.environ.get('TERM')
+            term = encoding.environ.get('TERM')
             # TERM won't be defined in a vanilla cmd.exe environment.
 
             # UNIX-like environments on Windows such as Cygwin and MSYS will