Closed (won't fix)
Project:
Drush
Version:
8.x-6.x-dev
Component:
Base system (internal API)
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Nov 2012 at 16:39 UTC
Updated:
18 Apr 2019 at 02:54 UTC
Jump to comment: Most recent
Comments
Comment #1
greg.1.anderson commentedLook at
function _drush_bootstrap_global_options(), and note that color is disabled if$colors = exec('tput colors 2>&1');does not return an integer >= 3. When you run a remote Drush command, Drush will use ssh to invoke the remote process, which will run without the $TERM environment variable being set. This will cause the remote tput command to return an error; Drush will therefore suppress color output, since it appears to Drush that the current (remote) terminal does not support it.To fix this, you'd have to modify backend invoke to set an option indicating that color should be used on the remote session, and you'd have to modify _drush_bootstrap_global_options to respect that flag.
Comment #2
patcon commentedThanks so much greg! I'll try to check into this tomorrow.
A quick search seemed to lead me to believe that this might be the key:
http://superuser.com/questions/163167/when-sshing-how-can-i-set-an-envir...
https://github.com/drush-ops/drush/blob/master/examples/example.drushrc....
I'll see if I can get it working through drushrc config before digging into a more long-term solution.
Thanks again!
Comment #3
greg.1.anderson commentedWith drushrc you could use 'command-specific' to set the 'nocolor' option if you wanted to get rid of color, but unfortunately, Drush does not have a 'color' option. You could set the TERM environment variable as you describe in #2; then you would only need to modify backend invoke. I can't think of any side effects of setting TERM, but there might be some.
Backend invoke is a little hairy...
Comment #4
greg.1.anderson commentedActually, you can use
$options['ssh-options'] = ...in drushrc to pass a TERM environment variable to remote calls without modifying backend invoke.Comment #5
owen barton commentedNote that depending on the sshd config the remote server may not allow remote setting of environment variables.
I wonder if simply passing the value of color detection on the "host" system (via a color option, which we would need to add) is the best fix here. I think this should work since everything is encoded (before even being output to the remote terminal) during backend invoke anyway.
Comment #6
greg.1.anderson commentedYeah, that was essentially my advice in #1. The env variable stuff looked like it might be easier, but as you mention, there are potential problems with that approach.
Comment #7
moshe weitzman commentedComment #8
greg.1.anderson commentedThis issue was marked
closed (won't fix)because Drush has moved to Github.If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to
closed (duplicate).Please ask support questions on Drupal Answers.
Comment #9
dannyw99 commentedSimply adding this to drushrc allowed me to pass a TERM evar which enabled color for remote drush and also works when called from jenkins, and no need to mess with ssh config: