nghung270192 / colorama

Automatically exported from code.google.com/p/colorama
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Version 0.3.3 broken in powershell #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. pip install pytest, which will install colorama 0.3.3
2. Run py.test
3. Note that escape sequences instead of colors get printed

I'm in powershell 2.0 on Windows 7.

Please provide any additional information below.

Downgrading to colorama 0.3.2 fixes the issue.

Original issue reported on code.google.com by floyd....@gmail.com on 29 Jan 2015 at 7:27

GoogleCodeExporter commented 9 years ago
I tried to reproduce this but couldn't. I ran py.test on Powershell 2.0 with 
colorama 0.3.3 and the colors showed correctly.
Can you see if you have an environment variable called 'TERM' set?
(in Powershell, it's: echo $env:TERM). This can explain the problem, otherwise 
I'm not sure what causes this on your environment.

Original comment by wiggi...@gmail.com on 17 Feb 2015 at 10:09

GoogleCodeExporter commented 9 years ago
Yep, TERM is set to cygwin, apparently posh-git sets that up. It's interesting, 
though, that downgrading to 0.3.2 restores expected behavior. So help me 
understand what the Right Thing (tm) is. Is posh-git doing the wrong thing? Why 
would colorama be sensitive to that env var?

Original comment by floyd....@gmail.com on 17 Feb 2015 at 2:26

GoogleCodeExporter commented 9 years ago
Starting from v0.3.3, colorama checks for the TERM environment and disables the 
ANSI emulation if it is defined. The colorama conversions now happen only on 
Windows *except* if the terminal is Cygwin, in which case the conversion is not 
needed and will not work (colorama didn't work properly on Cygwin in v0.3.2, 
see issue #16).
I haven't heard of posh-git before, but it doesn't seem right to set 
TERM=cygwin on Powershell...
(It looks like posh-git are setting the variable to enable colors, but git 
colors work without this definition, and there may be other ways to control 
this like "git config color.ui always")

Original comment by wiggi...@gmail.com on 1 Mar 2015 at 11:00

GoogleCodeExporter commented 9 years ago
This makes sense. I've opened an issue with posh-git, and I'm going to see what 
happens when I clear out the TERM variable. Thanks very much!

Original comment by floyd....@gmail.com on 3 Mar 2015 at 3:09