-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The "drush finder" script should respect drush being called with an absolute path. #2023
Comments
Yes, this has confused me as well on occasion. The intention here is to avoid dependency hell (which may result in unpleasantness if Drush and Drupal 8 have crossed dependency requirements, while still maintaining the convenience of a global Drush. Note that at the moment, you can use There should also be a way to disable redispatch (including an environment variable to persistently disable it). Automatically disabling redispatch when $0 contains a full path (or maybe even whenever $0 contains any path separator) would be a good idea. This does open you up to risk of dependency hell, but if you know that your global Drush is the most recent version, and all of your sites are either the latest Drupal 8, or Drupal 7 or earlier, then that won't be an issue. There are certainly use-cases for favoring the global Drush over the site-local Drush -- drush development being a prime example. Prior to the site-local Drush feature, alternatives similar to php-env were also discussed, but were passed over in favor of the current implementation. Not sure if this maybe should be reconsidered. |
An environment variable to disable redispatch seems reasonable to me. I'm actually pleased with how this redispatch feature turned out. I think we are avoiding a lot of cross dependency issues for our users. Sadly I don't know of a way to prove that claim. Drush has been around a long time and folks have long used a single global Drush for all their projects. This is a really bad approach in the Composer era. Composer built projects really want Drush to be part of the project so that dependencies are resolved at install time. IMO we need to actively protect end users from themselves here. I happen to know that both @greg-1-anderson and @webbj74 architect cli tools for hosting platforms. You guys are awesome - and highly non-standard Drush users! You probably want to use your own Drush install and not whatever dreck is in the site's /vendor. That's fine - use Greg's proposed environment variable. I'm open to further discussion on this. After all, I did get pretty smitten by a much simpler approach proposed at drupal-project. @webbj74 a bit less WTF and HUH would make your report a friendlier read. |
Yes, the Drush Finder has the huge advantage of doing the right thing in the average case, and doing Drush development is not a super common usecase for most Drush users. Let's fix the -dv problem, add the environment variable, and auto-set the environment variable when $0 contains a full path, and see how far that takes us. |
I would omit the absolute path item from the first patch. I don't think we
should vary behavior on that.
|
So, I'm going to close here, because it is actually destructive to stop Drush from redispatching to a site-local Drush when one exists. The problem is that the global Drush and the site-local Drush, when they are of different versions, are extremely likely to have conflicting dependencies. Moving forward with the global Drush would cause dependency-hell problems, and these are very hard to diagnose and impossible to support. |
The "look in the CWD" behaviour is really terrible. That's exactly like (for this particular command) having I can absolutely appreciate looking for a site-local drush in the root of the site being processed; but having the executable called by If people want to run I've worked around this in the only way I could see, by setting
|
Regardless of what path I specify drush at it tries to use my local vendor folder. Drush should behave like any other command when I specify the full path to a drush install.
If I want to run my local project's vendor/bin/drush I can specify the path.
Also, I shouldn't have to read the source code to discover why drush is behaving weird.
My steps:
-dv
to look under the hoodNo useful information returned with debugging output. I determined after reading the source, that "drush finder" was calling my project's
vendor/bin/drush
. WTF.The text was updated successfully, but these errors were encountered: