2

I have created a custom command for drush 10 in my drupal 8 setup. The command works fine from the terminal. However I want to run that command when the user clicks on form submit. I have tried using the below and I am getting the following errors

1. drush_invoke_process("@self", "my-custom-command");

Error: Call to undefined function drush_invoke_process()

2.

$alias_manager = Drush::service('site.alias.manager');
Drush::drush($alias_manager->getSelf(), 'my-custom-command')->run();

Error: Drush::$container is not initialized yet. \Drush::setContainer() must be called with a real container.

Am i missing something? Are there any alternatives to execute a drush command programmatically?

0 Answers0