Commit 6d3bf8f9 authored by DevShop's avatar DevShop

Save the Process component to drush context so implementors can get access.

parent 2e5b2b5a
......@@ -108,6 +108,9 @@ function drush_provision_drupal_pre_provision_verify() {
// Implement Symfony Process component for line-by-line output logging.
provision_process($composer_command, $composer_directory);
$process = drush_get_context('provision_process_result');
drush_log(print_r($process, 1), 'devshop_log');
}
}
......
......@@ -413,7 +413,7 @@ function _scrub_object($input) {
/**
* Execute a command against a specific context object.
*
*
* @param $target
* the context to operate on, @ prefix is optional.
* @param $command
......@@ -433,7 +433,15 @@ function provision_backend_invoke($target, $command, $arguments = array(), $data
}
/**
* Run a Symfony Process saving to drush logs.
* Run a command, sending output to drush logs in real time.
*
* The Symfony\Component\Process\Process Object is used to run this command.
* After implementing provision_process(), you can get the Process result object
* via drush context:
*
* $process = drush_get_context('provision_process_result');
* print $process->getExitCode();
*
*/
function provision_process($command, $cwd = null, $label = 'Process', $env = array(), $log_output = TRUE, $error_message = 'Process Failed') {
drush_log("[$label] $command", 'p_command');
......@@ -460,6 +468,9 @@ function provision_process($command, $cwd = null, $label = 'Process', $env = arr
$exit_code = $process->run();
}
// Save the Provision Process object to Drush Context so that implementors can access the full object.
drush_set_context('provision_process_result', $process);
// check exit code
if ($exit_code === 0) {
drush_log('', 'p_ok');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment