drush-ops / drush-launcher Goto Github PK
View Code? Open in Web Editor NEWA small wrapper around Drush for your global $PATH.
License: GNU General Public License v2.0
A small wrapper around Drush for your global $PATH.
License: GNU General Public License v2.0
Please give step-by-step instructions, as for a newbie.
I successfully installed Drupal Launcher and can confirm it works for all my D8 projects built with https://github.com/drupal-composer/drupal-project. Some with Drush 8, some with Drush 9, Drush Launcher always takes the right Drush from /vendor.
Now I do have some old Drupal 7 projects (all of them managed the old way, without Composer) here and would like to restructure them in a way to be able to use the Drush Launcher with them as well.
mkdir /User/norman/Sites/my-project
cd /User/norman/Sites/my-project
composer require drush/drush
mv /User/norman/Sites/old-d7-singlesite /User/norman/Sites/my-project/web
cd web
drush cc all
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.
- Add a site alias so Drush knows where your site is located.
Tried all of the suggestions, none of them worked, they all produce the same error message.
What else do I need to do to refurbish an old D7 project and make use of Drupal Launcher there?
$ composer --version
Composer version 1.6.1 2018-01-04 14:45:25
$ php --version
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
/var/www/demo/repo/web$ drush --version
Drush Launcher Version: 0.5.0
PHP Fatal error: Class 'Psr\Log\AbstractLogger' not found in /var/www/demo/repo/vendor/drush/drush/lib/Drush/Log/Logger.php on line 31
/var/www/demo/repo/web$ ../vendor/bin/drush --version
Drush Version : 8.1.15
Any other information I can provide? Or could it be I set something up wrong? I used the drupal-composer/drupal-project template to create the project.
psr/log is in vendor, and composer installed v1.0.2.
$ wget https://github.com/drush-ops/drush-launcher/releases/download/0.3.1/drush.phar
--2017-08-27 14:26:18-- https://github.com/drush-ops/drush-launcher/releases/download/0.3.1/drush.phar
Resolving github.com... 192.30.253.113, 192.30.253.112
Connecting to github.com|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/70282215/e6ed1bce-7c27-11e7-9255-d25c0c3aad82?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170827%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170827T132601Z&X-Amz-Expires=300&X-Amz-Signature=5062716e29955ecff69f28c558da14bd77ee5f1c70349fb23b681e25faf1af50&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Ddrush.phar&response-content-type=application%2Foctet-stream [following]
--2017-08-27 14:26:19-- https://github-production-release-asset-2e65be.s3.amazonaws.com/70282215/e6ed1bce-7c27-11e7-9255-d25c0c3aad82?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170827%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170827T132601Z&X-Amz-Expires=300&X-Amz-Signature=5062716e29955ecff69f28c558da14bd77ee5f1c70349fb23b681e25faf1af50&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Ddrush.phar&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com... 52.216.1.232
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com|52.216.1.232|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 273002 (267K) [application/octet-stream]
e6ed1bce-7c27-11e7-9255-d25c0c3aad82?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170827%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170827T132601Z&X-Amz-Expires=300&X-Amz-Signature=5062716e29955ecff69f28c558da14bd77ee5f1c70349fb23b681e25faf1af50&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment; filename=drush.phar&response-content-type=application%2Foctet-stream: File name too long
Cannot write to `e6ed1bce-7c27-11e7-9255-d25c0c3aad82?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20170827%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20170827T132601Z&X-Amz-Expires=300&X-Amz-Signature=5062716e29955ecff69f28c558da14bd77ee5f1c70349fb23b681e25faf1af50&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment; filename=drush.phar&response-content-type=application%2Foctet-stream' (Undefined error: 0).
I think it makes sense to distribute this program as a Phar and recommend that in install instructions. I can help if this is desired.
PHP Fatal error: Uncaught Error: Call to undefined function drush_set_option() in phar:///bin/drush/bin/drush.php:153
Stack trace:
#0 /bin/drush(10): require()
#1 {main}
thrown in phar:///bin/drush/bin/drush.php on line 153
When using drush-launcher to run drush 8x provided in vendor, global commands installed in ~/.drush are not available.
from within a d8 docroot:
$ drush --version
Drush Launcher Version: 0.5.1
Drush Version : 8.1.16
$ drush xkcd-fetch
The drush command 'xkcd-fetch' could not be found. Run `drush cache-clear drush` to clear the commandfile [error]
cache if you have installed new extensions.
$ vendor/drush/drush/drush xkcd-fetch
num : 1961
transcript :
alt : [They do not move.]
img : https://imgs.xkcd.com/comics/interaction.png
title : Interaction
date : 2018/2/28
Hi,
I am trying to replace webflo/drush-shim with drush/drush-launcher as recommended. On Travis CI builds I am now experiencing following dependency issue (using composer global require drush/drush-launcher):
Using version ^0.4.2 for drush/drush-launcher
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: webflo/drupal-finder[1.0.0, 0.4.2].
- Can only install one of: webflo/drupal-finder[1.0.0, 0.4.2].
- Can only install one of: webflo/drupal-finder[1.0.0, 0.4.2].
- drush/drush-launcher 0.4.2 requires webflo/drupal-finder ^1.0 -> satisfiable by webflo/drupal-finder[1.0.0].
- Installation request for drush/drush-launcher ^0.4.2 -> satisfiable by drush/drush-launcher[0.4.2].
- Installation request for webflo/drupal-finder (locked at 0.4.2) -> satisfiable by webflo/drupal-finder[0.4.2].
webflo/drupal-finder, 1.0.0 is included through dependencies in the project's vendor directory already.
Any idea what could cause this issue and how to resolve it?
Tried v 0.2.2 and 0.2.4, but everytime I run drush --version I get a message
/srv/www/foo# drush --version
Drush Shim Version: 0.2.2
Could not find Drupal in the current path.
That is the path where Drupal is...
In the documentation on installation, please state somewhere that Drush Launcher is ONLY compatible with Drupal 8 sites!
I wasted a few too many hours today wrestling with Drush Launcher since I am running D7 as well as D8 sites. Since Drush 9 is incompatible with D7, I would need to install Drush 8 on D7 and Drush 9 on D8. Using local installs with Drush Launcher seemed like a perfect solution.
However, one of the checks in the DrupalFinder dependency of Drush Launcher determines that the site is running Drupal 8. If the site is running Drupal 7, the launcher simply terminates with very little explanation as to why. The error it produces simply says "The Drush Launcher could not find a Drupal site to operate on." Which is a particularly maddening error if you have your root set to a perfectly valid D7 installation. :)
I mean, it also raises the question - why not work with D7 installations? But that's a separate issue. My goal here is just to ask the maintainer to PLEASE note somewhere in the documentation that this can only be used with Drupal 8 installations. Thank you in advance. :)
$drupalFinder->locateRoot()
returns a boolean but we seem to expect a string path at https://github.com/webflo/drush-shim/blob/0.0.3/bin/drush.php#L35
This was working before, but the sql-sync now fails after the upgrade. Looking for advice and to see if anybody else has seen this issue?
The command could not be executed successfully (returned: Array [error]
(
[default] => Array
(
[default] => Array
(
[database] => database_name
[username] => database_username
[prefix] => Array
(
[default] =>
)
[host] => localhost
[port] => 3306
[namespace] => Drupal\Core\Database\Driver\mysql
[driver] => mysql
)
)
)
, code: 0)
many years of training and scripting have taught users to specify --root on their calls to drush. thats ignored when using this shim. seems like a bad idea to me. lets honor that if presented and if not proceed with usual DrupalFinder().
drush-shim has no Symfony dependencies (except drupalFinder which itself has no dependencies). We are throwing it into a dirty pool when we ask users to install with composer global require
. We should recommend installing with plain old curl/wget or we should recommend cgr. This affected me upon first installing cgr because I had a global project which relied on symfony/console:3.x which is incompatible with drush and drupal8.
In either case, I think the only change needed is to README.md
composer global require webflo/drush-shim
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Can only install one of: webflo/drupal-finder[0.2.1, 0.3.0].
- Can only install one of: webflo/drupal-finder[0.3.0, 0.2.1].
- Can only install one of: webflo/drupal-finder[0.2.1, 0.3.0].
- webflo/drush-shim 0.1.0 requires webflo/drupal-finder ^0.2.1 -> satisfiable by webflo/drupal-finder[0.2.1].
- Installation request for webflo/drush-shim ^0.1.0 -> satisfiable by webflo/drush-shim[0.1.0].
- Installation request for webflo/drupal-finder (locked at 0.3.0) -> satisfiable by webflo/drupal-finder[0.3.0].
Please consider changing the installation command so that it will always install the latest version after a new release.
The following command will parse out the link to the latest version and download it. This can be useful when this is scripted for deployments, so it does not need to be changed for each new release.
curl -s -L https://github.com/drush-ops/drush-launcher/releases/latest | egrep -o '/drush-ops/drush-launcher/releases/download/[0-9.]*/drush.phar' | wget --base=http://github.com/ -i - -O drush.phar
One of my hosts has two Drupal 8.4.0-rc2 instances in different paths. Site aliases are properly configured. When my current working directory is outside these paths, all attempts to run drush end up with an error:
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.
- Add a site alias so Drush knows where your site is located.
When run inside a Drupal dir, drush works mostly, but site aliases are still not read (they're configured outside the project). It seems to me that drush is not even trying to read drushrc.php or aliases from ~/.drush or /etc/drush without --config option. Should it? And even --config doesn't help outside the project.
If I replace drush launcher with Drush 8.1.3 in /usr/local/bin, everything works just fine. Is this an environment problem, user error or a bug or feature in the launcher? (Running Ubuntu 16 & PHP7, Drush 9.0.0-beta4)
Can we get a release with the fix for interactive commands?
I am trying to debug some code using Xdebug and PHPStorm but I am having trouble configuring PHPStorm to correctly map the drush launcher phar file to a local file that PHPStorm can inspect. Without this mapping xdebug/PHPStorm seems to get confused about the execution path and never gets to the code I am trying to debug, it just hangs.
I have tried added the phar file locally as an external library but when I do this it doesn't appear as a mappable path.
I have tried adding the source code for drush and mapping drush
file to the drush launcher phar file. That doesn't work.
I have tried pulling the drush launcher source code down and mapping the bin/drush
file to the phar file on the remote. That doesn't work.
Any suggestions.
Since the latest security update for Drupal I see a lot of messages like the following in our log:
[warning] stat(): stat failed for phar:///Users/karl.fritsche/workspace/bio.logis_dev/scripts/drush.phar/bin/modules/contrib/igbinary/src/Component/Cache/MemoryBackendFactory.php PharStreamWrapper.php:453
It seems it happens when inside the drush command the igbinary stuff is included. This happens for custom command but also for drush cron
. It seems like the new introduced PharStreamWrapper.php somehow breaks functionality here.
As a workaround I extracted the drush launcher phar now and call the drush.php, that works, but somehow feels messy.
phar extract -f drush_launcher.phar drush_launcher
php drush_launcher/bin/drush.php cron
At least this is not producing this warning.
Anyone has some ideas whats going wrong here and how we could fix this?
The file I downloaded with wget according to the README instructions has this in it:
* @copyright Copyright (c) 2015 P√°draic Brady (http://blog.astrumfutura.com)
That looks like an encoding error.
I think it's easier and more sustainable / generalizable to install Drush Launcher via Composer, rather than manually downloading and placing the Phar file. I'm happen to open a PR if you'd be willing to have this documented in the README.
Basically:
composer global require drush/drush-launcher
.bash_profile
and add export PATH="$PATH:$HOME/.composer/vendor/bin"
I would love to see this program handle remote dispatching of requests like drush @foo status
. The goal is to simplify Drush such that once it receives a request, it knows that it will be operating locally (at least initially - the command itself can remote dispatch if needed). We will need to extract the alias parts of Drush into a new project so this shim can depend on it. This was barely started at https://github.com/drush-ops/drush-aliases. Would be good to spec this out some more.
ping @webflo @greg-1-anderson
When I run drush updatedb -l site.com --debug
the script stops in the middle and a pop-up message says "Windows can't open this type of file (.phar)"
Here is my console output:
λ drush updatedb -l site.com --debug
Drush Launcher Version: 0.6.0
ROOT: C:\inetpub\multisite
DRUSH VERSION: 9
DRUPAL ROOT: C:\inetpub\multisite/web
COMPOSER ROOT: C:\inetpub\multisite
VENDOR ROOT: [C:\inetpub\multisite/vendor]
[preflight] Config paths: C:\inetpub\multisite\vendor\drush\drush/drush.yml,C:\inetpub\multisite\drush/drush.yml
[preflight] Alias paths: C:\inetpub\multisite\web/drush/sites,C:/inetpub/multisite/drush/sites
[preflight] Commandfile search paths: C:\inetpub\multisite\vendor\drush\drush\src,C:\inetpub\multisite/drush
[bootstrap] Starting bootstrap to full [0.49 sec, 3.35 MB]
[bootstrap] Drush bootstrap phase 5 [0.49 sec, 3.35 MB]
[bootstrap] Try to validate bootstrap phase 5 [0.5 sec, 3.35 MB]
[bootstrap] Try to validate bootstrap phase 5 [0.5 sec, 3.36 MB]
[bootstrap] Try to bootstrap at phase 5 [0.5 sec, 3.42 MB]
[bootstrap] Drush bootstrap phase: bootstrapDrupalRoot() [0.5 sec, 3.43 MB]
[bootstrap] Change working directory to C:\inetpub\multisite/web [0.5 sec, 3.43 MB]
[bootstrap] Initialized Drupal 8.6.10 root directory at C:\inetpub\multisite/web [0.51 sec, 3.43 MB]
[bootstrap] Try to validate bootstrap phase 5 [0.51 sec, 3.43 MB]
[bootstrap] Try to bootstrap at phase 5 [0.52 sec, 3.59 MB]
[bootstrap] Drush bootstrap phase: bootstrapDrupalSite() [0.52 sec, 3.59 MB]
[bootstrap] Initialized Drupal site site.com at sites/site.com [0.52 sec, 3.59 MB]
[bootstrap] Try to validate bootstrap phase 5 [0.52 sec, 3.59 MB]
[bootstrap] Try to bootstrap at phase 5 [0.53 sec, 3.59 MB]
[bootstrap] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.53 sec, 3.59 MB]
[debug] Add service modifier [0.54 sec, 3.68 MB]
[bootstrap] Try to validate bootstrap phase 5 [0.54 sec, 3.68 MB]
[info] sql-query: SELECT 1; [0.55 sec, 3.69 MB]
[info] Executing: mysql --defaults-file="C:\\Users\\juan.bravo\\AppData\\Local\\Temp\\dru1362.tmp" --database=db --host=localhost --port=3306 --silent -A < "C:\\Users\\juan.bravo\\AppData\\Local\\Temp\\dru1361.tmp" > nul [0.55 sec, 3.69 MB]
[info] sql-query: SELECT 1 FROM key_value LIMIT 1; [0.8 sec, 3.69 MB]
[info] Executing: mysql --defaults-file="C:\\Users\\juan.bravo\\AppData\\Local\\Temp\\dru146E.tmp" --database=db --host=localhost --port=3306 --silent -A < "C:\\Users\\juan.bravo\\AppData\\Local\\Temp\\dru146D.tmp" > nul [0.8 sec, 3.69 MB]
[bootstrap] Try to bootstrap at phase 5 [1.05 sec, 3.69 MB]
[bootstrap] Drush bootstrap phase: bootstrapDrupalDatabase() [1.05 sec, 3.69 MB]
[bootstrap] Successfully connected to the Drupal database. [1.05 sec, 3.69 MB]
[bootstrap] Try to validate bootstrap phase 5 [1.05 sec, 3.69 MB]
[bootstrap] Try to bootstrap at phase 5 [1.05 sec, 3.69 MB]
[bootstrap] Drush bootstrap phase: bootstrapDrupalFull() [1.05 sec, 3.69 MB]
[debug] Start bootstrap of the Drupal Kernel. [1.05 sec, 3.69 MB]
[warning] Invalid json in modules/contrib/contentimport/composer.json [1.47 sec, 5.18 MB]
[debug] Found drush.services.yml for search_api Drush commands [1.49 sec, 5.19 MB]
[debug] Found drush.services.yml for webform Drush commands [1.5 sec, 5.19 MB]
[debug] Get container builder [1.51 sec, 5.19 MB]
[debugnotify] Service modifier alter. [1.51 sec, 5.26 MB]
[debug] process drush.console.services console.command [1.74 sec, 8.99 MB]
[debug] process drush.command.services drush.command [1.74 sec, 8.99 MB]
[debugnotify] Found tagged service config.commands [1.74 sec, 9 MB]
[debugnotify] Found tagged service config.export.commands [1.74 sec, 9 MB]
[debugnotify] Found tagged service config.import.commands [1.74 sec, 9 MB]
[debugnotify] Found tagged service batch.commands [1.74 sec, 9 MB]
[debugnotify] Found tagged service cli.commands [1.74 sec, 9 MB]
[debugnotify] Found tagged service drupal.commands [1.74 sec, 9 MB]
[debugnotify] Found tagged service entity.commands [1.75 sec, 9 MB]
[debugnotify] Found tagged service image.commands [1.75 sec, 9 MB]
[debugnotify] Found tagged service language.commands [1.75 sec, 9.01 MB]
[debugnotify] Found tagged service locale.commands [1.75 sec, 9.01 MB]
[debugnotify] Found tagged service messenger.commands [1.75 sec, 9.01 MB]
[debugnotify] Found tagged service queue.commands [1.75 sec, 9.01 MB]
[debugnotify] Found tagged service role.commands [1.75 sec, 9.01 MB]
[debugnotify] Found tagged service state.commands [1.75 sec, 9.01 MB]
[debugnotify] Found tagged service twig.commands [1.76 sec, 9.01 MB]
[debugnotify] Found tagged service user.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service views.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service watchdog.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service pm.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service theme.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service sanitize.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service sanitize.comments.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service sanitize.sessions.commands [1.76 sec, 9.02 MB]
[debugnotify] Found tagged service sanitize.userfields.commands [1.77 sec, 9.03 MB]
[debugnotify] Found tagged service sanitize.usertable.commands [1.77 sec, 9.03 MB]
[debugnotify] Found tagged service search_api.commands [1.77 sec, 9.03 MB]
[debugnotify] Found tagged service webform.commands [1.77 sec, 9.03 MB]
[debug] process drush.command_info_alterer.services drush.command_info_alterer [1.77 sec, 9.03 MB]
[debug] process drush.generator.services drush.generator [1.78 sec, 9.03 MB]
[debug] Finished bootstrap of the Drupal Kernel. [2.81 sec, 16.05 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigCommands [2.95 sec, 17.87 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigExportCommands [2.97 sec, 17.91 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\config\ConfigImportCommands [2.98 sec, 17.91 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\BatchCommands [2.99 sec, 17.92 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\CliCommands [3 sec, 17.92 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\DrupalCommands [3.01 sec, 17.93 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\EntityCommands [3.02 sec, 17.94 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\ImageCommands [3.04 sec, 17.94 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\LanguageCommands [3.05 sec, 17.96 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\LocaleCommands [3.08 sec, 17.96 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\MessengerCommands [3.09 sec, 17.98 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\QueueCommands [3.11 sec, 17.98 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\RoleCommands [3.14 sec, 17.99 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\StateCommands [3.16 sec, 18.01 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\TwigCommands [3.21 sec, 18.03 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\UserCommands [3.22 sec, 18.04 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\ViewsCommands [3.23 sec, 18.08 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\core\WatchdogCommands [3.27 sec, 18.11 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\pm\PmCommands [3.29 sec, 18.14 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\pm\ThemeCommands [3.32 sec, 18.15 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommands [3.35 sec, 18.15 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommentsCommands [3.37 sec, 18.16 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeSessionsCommands [3.39 sec, 18.16 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserFieldsCommands [3.41 sec, 18.16 MB]
[debugnotify] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands [3.43 sec, 18.17 MB]
[debugnotify] Add a commandfile class: Drupal\search_api\Commands\SearchApiCommands [3.44 sec, 18.17 MB]
[debugnotify] Add a commandfile class: Drupal\webform\Commands\WebformCommands [3.46 sec, 18.25 MB]
[command] Backend invoke: C:/inetpub/multisite/vendor/bin/drush.phar --backend=2 --verbose --debug --root=C:/inetpub/multisite/web --uri=site.com updatedb:status --entity-updates= --post-updates 2>&1 [3.76 sec, 19.92 MB]
[info] C:/inetpub/multisite/vendor/bin/drush.phar --backend=2 --verbose --debug --root=C:/inetpub/multisite/web --uri=site.com updatedb:status --entity-updates= --post-updates 2>&1 [3.76 sec, 19.93 MB]
drush.phar is located at vendor\bin together with drush.bat (which contains the extact two lines described here
I am able to run other commands such as drush cache-rebuild -l site.com
drush status -l site.com
I have checked these following issues:
Fix for Windows user
drush launcher on Windows
launcher placement for windows users
One minor documentation note I have from a windows perspective is that the suggested placement of drush launcher on the $PATH, is that /usr/local/bin is not a Windows path i.e. "c:>something". I don't believe windows CMD (or my IDE's terminal) works with drush commands if the launcher is placed at /usr/local/bin , because windows doesn't recognize this directory as a $PATH.
Global launcher solves the problem where modern Drupal sites ship with their own drush version. If i have drush in the vendor
directory of the current project, then great.
This provides great DX: "just run drush".
Not, "add this to your bashrc, or just run ./vendor/bin/drush".
Following this logic, the project might also ship with project-specific config. Aliases and options. This gives me the ability to say "just run drush @dev" and every projects is the same, regardless of the hosting. Outside of the project directory, I don't want anyone hit @dev and get this project. Inside the project, I don't want developers to deal with groups in their aliases. drush sa
should list @dev @stg @prod etc, and that's it.
Two solutions I can think of:
In the drush 8.x project, perhaps it could load drushrc earlier, at least to look for --local, but I fear this is probably a fragile order of operations.
If you use --fallback=/opt/drush.8.phar
but the launcher finds a drush 9, the drush call fails with The "--fallback" option does not exist.
I'm not sure and didn't tested it as I just use the envoirment variable now, but I think in $_SERVER['argv']
the --fallback=...
needs to be removed. The prepareArgument
function is only called if the fallback is used.
Hi There,
Sorry if I am missing something simple. Other than giving Drush 9 a different name than older versions of Drush is there a way to run multiple versions of Drush at the same time? So Drush 8 for Drupal 7 and Drush 9 for Drupal 8.5+.
Thanks,
Steve
Hello,
I have a drupal 7 project, and the git is only available in profile folder: /www/profiles/myprofile/myprofile.make
In this folder has a make file and we run remake command if we put a new module or something to this. But now I can not run the drush make command because the error message is:
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.
It is not care where I am (www or profile folder) the result is all the same. Should I add a conigure file to somewhere? If I add drush status
command the result is the same
Since *.phar files may need to be executed with the php
command, you can't run the command from anywhere. To mitigate this, create a drush.bat
file in the same folder as drush.phar
with the following lines:
@echo off
php %~dp0\drush.phar %*
That will run the Drush Launcher from anywhere on Windows.
not to repeat the question, but does this conflict if I'm running drupal7 on the same server?
Today, you can run drush
from anywhere and get a help listing. Same for some commands like version
and status
. When you do this with drush-shim, you see 'Could not find Drupal in the current path.'. Share your thoughts on how we should handle this use case.
Current
drush use @example.dev && drush status
doesn't show any variables from the configured alias../vendor/bin/drush use @example.dev && ./vendor/bin/drush status
shows all the variables from the used alias.Expected
Drush launcher shows exactly the same output as ./vender/bin/drush when a site:set
/use
is used.
Setup
Alias file [project root]/drush/sites/example.site.yml
:
dev:
uri: https://example.drupal.local:9443
root: /var/www/app/web
docker:
service: app
exec:
options: -u1000
paths:
drush-script: '/var/www/app/vendor/bin/drush'
At present, if I were to execute drush @alias uli
in a directory containing vendor/bin/drush
that did not have a Drupal root (anywhere), the launcher would be unable to detect my drush installation and execute the command.
The launcher should be able to detect a project version of drush even if that project does not contain Drupal root.
Is there a reason why drush uses the system mysql cli instead of using the php module for db operations ?
Thank you!
I have Drush Launcher installed and it is working and finding my site local Drushes. However I have one site that I still need to used Drush 8 on with php 5.6. I have installed a site local Drush 8 for this site. Drush launcher find and run the site local, however it uses the default php of 7.1. Several versions of php are available.
If I include the path on the command line to php 5.6 and set the DRUSH_PHP on the command line to the same path to php, I can get the the site local drush 8 to run with php 5.6.
I tried hacking the drush.launcher that came with Drush 8 to set the path to php but it appears that when launching Drush with this project, drush-launcher, that this file is not run. and it ends up using the default PHP 7.1.
I know in a previous issue it was stated that Drush was out of the business of setting up the php environment as it was too complex to maintain this. However it would be nice if there was a way to set the php version for site local versions of Drush. Which it appears that there is not unless you count typing out a mile long command every time to set the exact path to the php binary, set DRUSH_PHP and the exact path to the Drush binary to use.
drush updatedb doesn't work with windows, you get this error:
'C:/.../AppData/Roaming/Composer/vendor/drush/drush-launcher/bin/drush' is not
recognized as an internal or external command,
operable program or batch file.
[error] The command could not be executed successfully (returned: 'C:/.../Roaming/Composer/vendor/drush/drush-launcher/bin/drush' is not recognized as an internal or external command,
operable program or batch file.
, code: 1)
To fix it, you have to create a drush.bat file in ...\AppData\Roaming\Composer\vendor\drush\drush-launcher\bin
with these lines:
@echo off
php %~dp0\drush.php %*
In the main page the doc is outdated or wrong. You wrote user must look for drush.phar but there is no drush.phar installed. Also file content is outdated, you have to refer to drush.php and not drush.phar
Hi.
Thank you for the project.
Please update the version in the readme like curl -OL https://github.com/drush-ops/drush-launcher/releases/download/0.4.1/drush.phar
Thank you.
When using Drush Launcher version 0.6.0 and trying to run drush on a Drupal 7 site, I get the error "The filename, directory name, or volume label syntax is incorrect." When I run vendor/bin/drush, it works fine.
When I run composer global require webflo/drush-shim
and then run drush status
I get
/bin/sh: 1: drush: not found
We depend on phar-updater but it is not clear how to use it.
drush --debug
output
ROOT: /var/www/html/debates/web/my-website
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.
The path /var/www/html/debates/web/my-website
contains Drupal 7 installation. What shall I do???
I notice we have new releases https://github.com/composer/xdebug-handler/releases
Would you please give more details on how to install it locally on Windows! I am new to composer and drush. I installed drupal using the drupal-composer/drupal-project and drush was installed in the process but it still "is not recognized as an internal or external command,
operable program or batch file." . My search led me here but I'm now puzzled by how to install the launcher on Windows. Cheers
I am running the Linux subsystem and
bash -x ../vendor/drush/drush/drush.launcher
+ $'\r'
../vendor/drush/drush/drush.launcher: line 9: $'\r': command not found
++ dirname -- ../vendor/drush/drush/drush.launcher
+ SELF_DIRNAME=$'../vendor/drush/drush\r'
(I replaced the full path with .. for privacy reasons.)
Apparently it has some problems with line endings.
Hello,
When using Drush 9.6.2 on Linux with an SSH alias, commands are interactive.
However, when calling it through Drush Launcher 0.6.0, commands are not interactive.
It seems this is caused by XdebugHandler:
Line 123 in 74f678e
Before, posix_isatty(STDOUT)
returns true and after, it returns false.
Would it be possible to tell XdebugHandler that we are using a TTY?
I'm seeing version mismatch between the embedded drush.phar and drupal. I suggest removing the embedded drush.phar. Note - I'm using an earlier version of drush-shim.
~/reps/d8/modules/devel (8.x-1.x *>) $ drush genc 55 --kill
PHP Fatal error: Declaration of Drush\Command\DrushInputAdapter::hasParameterOption($values) must be compatible with Symfony\Component\Console\Input\InputInterface::hasParameterOption($values, $onlyParams = false) in phar:///Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/phar/drush.phar/lib/Drush/Command/DrushInputAdapter.php on line 27
PHP Stack trace:
PHP 1. {main}() /Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/bin/drush:0
PHP 2. require() /Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/bin/drush:4
PHP 3. drush_main() /Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/bin/drush.php:112
PHP 4. Drush\Boot\DrupalBoot8->bootstrap_and_dispatch() phar:///Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/phar/drush.phar/includes/preflight.inc:66
PHP 5. drush_dispatch($command = *uninitialized*, $arguments = *uninitialized*) phar:///Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/phar/drush.phar/lib/Drush/Boot/BaseBoot.php:67
PHP 6. drush_command(*uninitialized*, *uninitialized*) phar:///Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/phar/drush.phar/includes/command.inc:199
PHP 7. _drush_invoke_hooks($command = *uninitialized*, $args = *uninitialized*) phar:///Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/phar/drush.phar/includes/command.inc:231
PHP 8. spl_autoload_call(*uninitialized*) phar:///Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/phar/drush.phar/includes/command.inc:353
PHP 9. Composer\Autoload\ClassLoader->loadClass($class = *uninitialized*) phar:///Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/webflo/drush-shim/phar/drush.phar/includes/command.inc:353
PHP 10. Composer\Autoload\includeFile($file = *uninitialized*) /Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/composer/ClassLoader.php:322
PHP 11. include() /Users/moshe.weitzman/.composer/global/webflo/drush-shim/vendor/composer/ClassLoader.php:444
A few different people have confirmed that when XDebug is enabled and running commands through the launcher for Drush 9 the command hangs up and doesn't actually pass through to the database.
The biggest offender seems to be sql:cli
so far.
If you access drush directly through the vendor/bin/drush executable then it works but when using the drush launcher it seems to hang up and not make a connection to the database.
When you disable xdebug then this works.
For Reference: docksal/docksal#795
Hi,
on my localhosts, I'm working on both Drupal 7 and Drupal 8 projects. Currently, I have drush 8 installed globally and for each Drupal 8 project a local Drush 9 via composer. I have also drush-launcher installed. I aliased drush to a drush8 command. It would be great if drush launcher could detect if I am in a Drupal 7 oder Drupal 8 project, and if the former, invoke a global drush 8 installation, and if the latter, invoke the local Drush 9.
Best,
Franz
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.