git cl status no longer coloring statuses on Windows, showing control characters |
||
Issue descriptiongit cl status used to show colored code URLs but now it shows the control characters. This is presumably related to the recent git upgrade. The control characters don't transfer perfectly to raw text but the [36m and [39m bits are the problem: guard_test : [36mhttps://codereview.chromium.org/1738643002 (closed)[39m
,
Apr 2 2016
Can you confirm that your cmd.exe shell doesn't have the envvar %TERM% set to anything?
,
Apr 2 2016
Actually, even with TERM set, I'm still getting colors in both cmd.exe and `git bash`. I'm on windows 10... maybe cmd.exe is different now?
,
Apr 2 2016
Confirmed - no TERM. Note also that on my Windows 8 machine I saw it go from working to not working without anything changing except that I ran "gclient" a couple of times in a separate command window. I have seen this behavior (control characters) on four different Windows machines from three different developers.
,
Apr 2 2016
actually I take that back: I only see colors in cmd.exe right now (looks like a bug)
,
Apr 2 2016
I'm seeing the same behavior on Windows 7, 8.1, and 10. Try running "gclient" a few times and see if it stops working? Dunno.
,
Apr 2 2016
I've been running gclient all day :D. I'll try running it a bunch of times in the same prompt, but it sounds like voodoo to me.
,
Apr 2 2016
Voodoo works whether you believe in it or not, just like science.
,
Apr 2 2016
Here's what I see after running gclient 10 times in a cmd shell :/
,
Apr 2 2016
git version: 2.7.4.windows.1 depot_tools version: crrev.com/ecd95be01fc6276036287c289c4232d1a9596fa6
,
Apr 2 2016
What version of depot_tools are you on?
,
Apr 2 2016
ecd95be01fc6276036287c289c4232d1a9596fa6, https://codereview.chromium.org/1847283003, from Apr 1 22:43:39
,
Apr 2 2016
Ok, so I think what's happening is that colorama has decided that it should be emitting ANSI color codes. These SHOULD work on windows 10 OOTB (since cmd.exe now supports some ANSI escape codes), but colorama's fallback of using the windows native coloring routines doesn't seem to be kicking in. If you edit the line in git_cl.py which looks like `colorama.init(...)` to be just `colorama.init()` does that cause coloring to work again?
,
Apr 2 2016
Wait, you saw this behavior on win10? Now I'm really confused... are you /sure/?
,
Apr 2 2016
Heh, I think I actually figured this out. Even though cmd doesn't set $TERM, msysgit's bash.exe does... and when you do `git something`, it's running inside of bash. I think I know how to fix this though.
,
Apr 2 2016
Turns out there's a bunch of madness :) CL: https://chromiumcodereview.appspot.com/1851283002
,
Apr 2 2016
So the reason this happened is because I attempted to enable color output for msys bash (aka `git bash`). I figured since TERM isn't defined for cmd, we can just use that as a signal that we're running in a non-cmd terminal emulator. However, when you run `git command` (like `git cl`) it runs `bash /path/to/git-command`, and bash sets TERM in the environment. I think the CL above detects all the cases.
,
Apr 4 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/596cd5c95d2a85df1598a72cd211104beb7cf19f commit 596cd5c95d2a85df1598a72cd211104beb7cf19f Author: iannucci@chromium.org <iannucci@chromium.org> Date: Mon Apr 04 21:34:39 2016 Fix coloring madness in depot_tools. 'setup_color' now contains logic to correctly detect: * cmd * cmd pipe * msys bash * msys pipe * cmd running inside msys bash (git-command) * cmd pipe running inside msys bash (git-command > outfile) R=brucedawson@chromium.org, dnj@chromium.org BUG= 600049 Review URL: https://codereview.chromium.org/1851283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299682 0039d316-1c4b-4281-b951-d872f2087c98 [modify] https://crrev.com/596cd5c95d2a85df1598a72cd211104beb7cf19f/depot-tools-auth.py [modify] https://crrev.com/596cd5c95d2a85df1598a72cd211104beb7cf19f/gclient.py [modify] https://crrev.com/596cd5c95d2a85df1598a72cd211104beb7cf19f/git_cl.py [modify] https://crrev.com/596cd5c95d2a85df1598a72cd211104beb7cf19f/git_common.py [modify] https://crrev.com/596cd5c95d2a85df1598a72cd211104beb7cf19f/git_map_branches.py [add] https://crrev.com/596cd5c95d2a85df1598a72cd211104beb7cf19f/setup_color.py
,
Apr 4 2016
I think this one's in the bag. Going to work on the crash next. |
||
►
Sign in to add a comment |
||
Comment 1 by brucedaw...@chromium.org
, Apr 2 2016