hgext/color.py
changeset 12065 a8b1cb0b0ddb
parent 12062 c327bfa5e831
child 12084 ff7c1118a83a
--- a/hgext/color.py	Wed Aug 25 23:26:18 2010 +0100
+++ b/hgext/color.py	Fri Aug 27 22:24:47 2010 -0500
@@ -254,8 +254,10 @@
         'inverse': win32c.COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only
     }
 
-    stdout = win32c.GetStdHandle(win32c.STD_OUTPUT_HANDLE)
     try:
+        stdout = win32c.GetStdHandle(win32c.STD_OUTPUT_HANDLE)
+        if stdout is None:
+            raise ImportError()
         origattr = stdout.GetConsoleScreenBufferInfo()['Attributes']
     except pywintypes.error:
         # stdout may be defined but not support