-
Notifications
You must be signed in to change notification settings - Fork 396
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
Parameters not passed when invokeCommand is used with @executeInDrupalVM #1866
Comments
This is surprising to me-- There are certainly many cases in which we are successfully passing parameters to this method, and invoking that command in the VM. |
I am not able to reproduce this on 8.x.
|
I noticed two things about your posting. First, your annotation is not in the correct case. The "M" in Second, you did not post commands that you ran on the CLI. Would you mind sharing it? |
Oh, I think I know your issue. You have a typo in the word |
@grasmash sorry, some of that is just copy pasta. Here's the command /**
* Lints the theme's Javascript.
*
* @command theme:scripts:lint
*
* @param string $path
* An optional path to restrict linting to.
*
* @description Lints the theme's Javascript.
* @executeInDrupalVm
*/
public function lintScripts($path = '') {
$task = $this->taskExec('gulp')
->arg('eslint');
if (!empty($path)) {
$task->option('path', $path);
}
$task->run()
->stopOnFail();
} |
Can you share the full method, including the body? And, also the command that you ran on the CLI? |
@grasmash sure, I updated the content above. If I put a
This is when calling the following function in a Robo watch task: $this->invokeCommand('theme:scripts:lint', ['path' => $path]); |
This is perhaps related, the watch method's signature is this: /**
* Watches files, and validates and re-builds assets when source files change.
*
* @command theme:watch
* @description Watches files, and validates and re-builds assets when source files change.
*/
public function watch() {} Note that it doesn't have the The command I'm running then is |
If I use this to construct the command arguments in $args = $event->getInput()->getArguments();
...
foreach ($args as $arg) {
$command_parts[] = $arg;
} The order of arguments looks be preserved by |
Would you mind submitting a pull request with the improvement? |
@grasmash I've discovered this issue is particular to the Robo watch task. Closing this issue. I will open up a new issue that provides better steps for reproducing the behavior. |
My system information:
When I run
invokeCommand
on a custom command which uses the@executeInDrupalVM
annotation:I get the following output:
And I expected the parameter to be passed to my command:
The text was updated successfully, but these errors were encountered: