Skip to content

Commit

Permalink
Merge pull request #6 from digitaldomain/feature-windows_support
Browse files Browse the repository at this point in the history
Fixing the Windows support.
  • Loading branch information
Ahuge authored May 3, 2018
2 parents e8e61cf + 56f9e8f commit 179add4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/python/qt_py_convert/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ def supports_color():
plat = sys.platform
supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
'ANSICON' in os.environ)
p = subprocess.Popen(
["tput", "colors"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
has_colors = p.communicate()[0].strip(b"\n")
try:
has_colors = int(has_colors)
except:
has_colors = False
p = subprocess.Popen(
["tput", "colors"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
has_colors = p.communicate()[0].strip(b"\n")
try:
has_colors = int(has_colors)
except:
has_colors = False
except OSError: # Cannot find tput on windows
return False

# isatty is not always implemented, #6223.
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
Expand Down

0 comments on commit 179add4

Please sign in to comment.