Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Command arguments lost when invokeCommand is called with @executeInDrupalVm within a Robo watch task #1872

Closed
bobbygryzynger opened this issue Aug 2, 2017 · 3 comments
Assignees
Labels
Bug Something isn't working

Comments

@bobbygryzynger
Copy link
Contributor

bobbygryzynger commented Aug 2, 2017

Clarifies #1866.

My system information:

  • Operating system type: macOS
  • Operating system version: 10.12.5
  • BLT version: 8.9.0

When I run invokeCommand within a Robo watch task on a command which uses the @executeInDrupalVm annotation:

<?php

namespace Acquia\Blt\Custom\Commands;

use Acquia\Blt\Robo\BltTasks;
use Lurker\Event\FilesystemEvent;

class WatchCommand extends BltTasks {

  /**
   * @command hello
   * @param string $friend
   * @executeInDrupalVm
   */
  public function hello($friend) {
    $this->say("Hello, $friend.");
  }

  /**
   * @command watch
   */
  public function watch() {
    $this->taskWatch()
    ->monitor($this->getConfigValue('repo.root'), function(FilesystemEvent $event) {
      $this->invokeCommand('hello', ['friend' => 'friend']);
    })->run();
  }

}

When I run this command and alter a file:

blt watch

I get the following output:

$ blt watch
[Watch] Watching /Users/<user>/Sites/<project> for changes...
> hello
Executing command blt hello --define drush.alias=self inside of Drupal VM...
[warning] The xDebug extension is loaded. This will significantly decrease performance.

                                                          
  [Symfony\Component\Console\Exception\RuntimeException]  
  Not enough arguments (missing: "friend").               
                                                          

hello [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-y|--yes] [-D|--define DEFINE] [--] <command> <friend>

If I remove the @executeInDrupalVm annotation I get the expected output:

$ blt watch
[Watch] Watching /Users/<user>/Sites/<project> for changes...
> hello
Hello, friend.
@grasmash
Copy link
Contributor

Can you test the changes made by #1998 ?

@bobbygryzynger
Copy link
Contributor Author

@grasmash I'm afraid I'm still seeing the same behavior described above. When @executeInDrupalVm is used I get the following output:

[Watch] Watching /Users/<user>/Sites/<project> for changes...
> hello
[error]  Not enough arguments (missing: "friend"). 

The required argument still isn't getting passed along.

@bobbygryzynger
Copy link
Contributor Author

@grasmash I'm also finding that #1988 strips off global --define arguments. I would expect that global assignments would be preserved through sub-invokations.

wu-edward pushed a commit to wu-edward/blt that referenced this issue Sep 28, 2017
…d with @executeInDrupalVm within a Robo watch task.
wu-edward pushed a commit to wu-edward/blt that referenced this issue Sep 28, 2017
…d with @executeInDrupalVm within a Robo watch task.
grasmash pushed a commit that referenced this issue Sep 29, 2017
… @executeInDrupalVm within a Robo watch task. (#2052)
briantully added a commit to briantully/blt that referenced this issue Feb 8, 2018
* acquia/8.x: (1264 commits)
  Update composer.json
  Use the correct command for setup.strategy = sync (acquia#2097)
  Provide better Memcached boilerplate config. (acquia#2063)
  Note about docker and headless chrome (acquia#2091)
  Fixes acquia#2072: temporarily disabling checking of features overrides. (acquia#2082)
  Drupal 8.4 compatibility improvements. (acquia#2080)
  Update .travis.yml
  Removing sudo from Travis. (acquia#2066)
  Fixes acquia#2059: override site uri during deploy:update. (acquia#2060)
  Remove any NULL arguments from original command being passed into VM, so that missing arguments detected faster. (acquia#2058)
  Add additional settings file include options acquia#2054 (acquia#2055)
  Add support for Apache Solr search (Acquia Search) acquia#412. (acquia#2053)
  Fixes acquia#1872: Command arguments lost when invokeCommand is called with @executeInDrupalVm within a Robo watch task. (acquia#2052)
  Cleaning up composer requirements. (acquia#2050)
  Update configuration-management.md (acquia#2051)
  Fixes acquia#2048: PHP Warning when using modules.local.uninstall: null. (acquia#2049)
  Fixes acquia#2046: Modifying BLT Configuration definition is not accurate. (acquia#2047)
  Fixes acquia#2040: Assert existence of .nvmrc or .node-version. (acquia#2042)
  Add back line removed in acquia#2039 (acquia#2043)
  Fix spacing in simplesamlphp setup readme. (acquia#2044)
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants