Closed (fixed)
Project:
Drush
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2009 at 21:48 UTC
Updated:
21 Oct 2009 at 16:30 UTC
Jump to comment: Most recent file
When using the windows cmd window to run Drush, the bash color changing codes are printed out, so I see stuff like:
No code updates available. <-[0;33m<-[1m
[ok]<-[0m
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 488058-nocolor.patch | 999 bytes | smk-ka |
| #14 | 488058-nocolor.patch | 1.33 KB | smk-ka |
| #11 | 488058-nocolor.patch | 1.24 KB | smk-ka |
| #10 | 488058-nocolor.patch | 1.24 KB | smk-ka |
| #3 | drush_nocolor.patch | 2.25 KB | mikeryan |
Comments
Comment #1
brad.bulger commentedi am tempted to change the name of this to be just "are annoying", period. i am running on Ubuntu in bash and it is of no value to me to have warnings come out in an invisible yellow color. how can we get rid of that stuff altogether?
update: i asked before trying, bad user :) it's not a hard hack, but it would still be good if it was configurable. i edited includes/drush.inc and added this redefinition of the color strings to the _drush_print_log() function:
Comment #2
starbow commented@tatere, thanks for the tip.
Comment #3
mikeryanHere's a patch adding a -n/--nocolor option to suppress the color codes. I'm not really motivated, but if someone can work out the codes to color Windows command prompts, perhaps a better approach would be something like -h/--highlight=[none|Unix|Windows].
Comment #4
jonhattanThis is a related issue: #459572: yellow unreadable on white background terminal
Comment #5
moshe weitzman commentedIf it really looks bad for all windows clients, we should probably set this by default for them. Can we identify which terminals do not support it?
We just fixed the "invisible yellow color" issue.
Comment #6
moshe weitzman commentedAnyone willing to work on a patch which autodetects when to trigger nocolor? Or does nice coloring even for windows?
Comment #7
mikeryanAutodetecting windows, and suppressing/using Windows colors, would be nice. I think having an explicit flag is still useful - it's also helpful to suppress the escape coding when running in a script, where you're dumping the output to a log/scanning for [error]/etc.
Here's a ref on Windows color-coding, no time to try it right now...
http://stackoverflow.com/questions/77744/how-can-i-change-the-text-color...
Comment #8
moshe weitzman commentedcommitted.
Comment #9
moshe weitzman commentedactually, i'll leave this open in case someone can come up with a solution that looks good on windows.
Comment #10
smk-ka commentedTwo enhancements:
1. Since Windows doesn't support ANSI codes, color is always disabled for this OS
2. Added terminal color capabilities detection, we need at least
tput colors 3for red, yellow, and green.Needs testing, except on Windows.
Comment #11
smk-ka commentedSlightly improved version redirecting STDERR to avoid error messages.
Comment #12
brad.bulger commentedworks keen for me - no colors in my colorless term.
Comment #13
moshe weitzman commentedI can confirm that this keeps colors working as desired on OSX.
One last question - the orginal report was that colors do not work within cmd shell on Windows. It seems like this patch will also disable colors for Cygwin shell, putty, etc. Is that desireable? Are those popular enough to matter?
Comment #14
smk-ka commentedD'oh, totally forgot about cygwin... that's easy, though: Windows command prompt doesn't have the TERM environment variable defined, while *nix based terminals do. New patch additionally looks for TERM on Windows.
Comment #15
moshe weitzman commentedcommitted. thx.
Comment #16
mikeryanRunning in a script spits out
tput: No value for $TERM and no -T specified
Which may cause some ops types a little anxiety... Any reason not to toss an @ on the exec('tput... call?
Thanks.
Comment #17
smk-ka commentedBased on the error message you gave I would rather assume that it is sufficient to always look for the presence of a TERM in the environment, not only on Windows systems. Attached follow-up patch does exactly that, tested on Windows, Cygwin, Linux. Could you please check if it works for you too?
Comment #18
netaustin commentedLooks fine; not getting that error when run in a script.
Comment #19
moshe weitzman commentedCommitted - thanks.