In order to separate platform from application (the drush 9 problem) we need to start running things as process, instead of including code and bootstrapping Drupal PHP directly.

In order to do this elegantly we should include Symfony Process.

DevShop has done this for a long time: https://github.com/opendevshop/devmaster/blob/7.x-1.x/modules/devshop/de...

By using symfony process real-time output, we can call drush_log() inside the loop and get realtime output in the browser.

We should obviously not use drush_log type "devshop_log", but instead perhaps, "provision_process". That way we can alter the display like devshop does to resemble terminal output.

I would love to put this directly in provision instead of devshop, and remove all of my custom logging code.

CommentFileSizeAuthor
#4 2974291-symfony-process.patch194.19 KBfastangel
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Jon Pugh created an issue. See original summary.

Jon Pugh’s picture

helmo’s picture

+1 :)

fastangel’s picture

Assigned: Unassigned » fastangel
Status: Active » Needs review
FileSize
194.19 KB

I attach the patch I was working with @jon for fix this problem.

helmo’s picture

Thanks,

I've applied it on a dev server and tried to the new provision_process function in a second location.

There it's replacing drush_shell_exec and like it was in the provision_composer_install_command case it's looking for a boolean return code.

What would be the way to test in following code if the command executed OK?

Jon Pugh’s picture

If the shell exec fails, a drush_set_error() is thrown, so checking drush_get_error() might be the best way?

Other options could include throwing an exception, so that each implementation can catch it in it's own way? Typically with a drush_SEt_error but could be other things.

In provision 4, I've used a function parameter to let the invoker request what return value they want: https://github.com/provision4/provision/blob/4.x/src/Provision/Context.p...

  • fastangel authored 2e5b2b5 on 7.x-3.x
    Issue #2974291 by fastangel: Add Symfony Process component and a `...
Jon Pugh’s picture

Status: Needs review » Fixed

This is a huge step for Aegir.

Thank you fastangel!

Jon Pugh’s picture

Helmo: Jacinto also added this to Hosting Git, so now when using composer platforms in git, you see the git clone and the composer install in real time!

I just added a new commit that should resolve the need to do further testing of the result: You can now get the full Process object via
drush_get_context('provision_process_result');

It works great!

$process = drush_get_context('provision_process_result');
print $process->getExitCode();

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.