Skip to content

Commit

Permalink
got cmd colors back: fix win color issue after #8
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Jun 25, 2016
1 parent 3674d38 commit ce2db92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion socli/socli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ def supports_color():
"""
plat = sys.platform
supported_platform = plat != 'Pocket PC' and (plat != 'win32' or 'ANSICON' in os.environ)

# To detect windows 10 cmd. Windows 10 cmd supports color by default
if os.name=="nt":
x=sys.getwindowsversion()[0]
if x==10:
try:
test_shell=os.environ['SHELL'] # If running with a shell like cygwin this is set
except Exception:
return True
# isatty is not always implemented, #6223.
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
if not supported_platform or not is_a_tty:
Expand Down
11 changes: 11 additions & 0 deletions socli/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys,os
try:
x = sys.getwindowsversion()[0]
if x == "10":
print("windows detected")
try:
tet_shell = os.environ['SHELL']
except Exception:
print("shell detected")
except Exception:
pass

0 comments on commit ce2db92

Please sign in to comment.