Instead of trying to bootstrap the Symfony Console application inside Drush, try running composer in another process whose output is logged by Drush. This avoids the need to preserve $argc and $argv and behaves better with the latest version of Composer.

In this patch, output from composer is filtered aggressively, and input is taken over by a symfony Process object which uses STDIN to pass the script to run Composer. I bet using Drush process commands this would integrate more nicely for input, though I do not know about output.

CommentFileSizeAuthor
#1 isolate-process-2347977-1.patch2.2 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Anonymous’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
RobLoach’s picture

Looks great! Couple questions...

  1. +++ b/composer.drush.run.inc
    @@ -41,24 +42,49 @@ function drush_composer_run($arguments = array()) {
    +\$application->run();
    

    Any reason for the \ ?

  2. +++ b/composer.drush.run.inc
    @@ -41,24 +42,49 @@ function drush_composer_run($arguments = array()) {
    +    ->setEnv(array('COMPOSER_HOME' => __DIR__))
    

    Do we need to change COMPOSER_HOME here? This will force all global calls to reference ~/.drush/composer directory rather than ~/.composer ... Is this intentional?

  3. +++ b/composer.drush.run.inc
    @@ -41,24 +42,49 @@ function drush_composer_run($arguments = array()) {
    +  $data = rtrim($data, " \t\n\r\0\x0B\x08");
    

    Some docs to describe what this is doing would be great :-) .