[juampy@carboncete ~]$ cd /path/to/drupal7
[juampy@carboncete /path/to/drupal7 (master)]$ DRUSH_LAUNCHER_FALLBACK=/usr/share/drush/drush
[juampy@carboncete /path/to/drupal7 (master)]$ drush st
The Drush launcher could not find a Drupal site to operate on. Please do *one* of the following:
- Navigate to any where within your Drupal project and try again.
- Add --root=/path/to/drupal so Drush knows where your site is located.
After debugging the launcher, I found out that getenv() was returning false. I fixed this by exporting the variable instead of just setting it.
This pull request does two things:
Adjust the docs so the fallback variable is exported.
Move the fallback via environment variable logic out of the arg loop as otherwise it would be unnecessarily evaluated more than once if there are several unexpected arguments. The new logic also allows having an environment variable but overriding it via an option, which is a practice that I have seen in other projects.
I tried today the Drush launcher with a Drupal 7 project and, after finding https://github.com/drush-ops/drush-launcher/pull/39 and updating it, I did the following:
After debugging the launcher, I found out that
getenv()
was returning false. I fixed this by exporting the variable instead of just setting it.This pull request does two things: