diff --git a/provision.inc b/provision.inc index fd4f705e95ecf5927b7e8a03c827fd8695cd2cd9..daea97cfc2d4535bc0f4adcabc8d5b3299c64497 100644 --- a/provision.inc +++ b/provision.inc @@ -442,8 +442,25 @@ function provision_backend_invoke($target, $command, $arguments = array(), $data * $process = drush_get_context('provision_process_result'); * print $process->getExitCode(); * + * @param string $command + * The command to run + * @param null $cwd + * The directory to run the command in. + * @param string $label + * A string to display above the command block in the front-end. + * @param array $env + * A list of environment variables to set for the process. + * @param bool $log_output + * Whether or not to send output to drush_log in real time. + * @param null $error_message + * The error message to show after a failure. Defaults to NULL because the UI turning red and the error output is usually enough. + * @param bool $throw_drush_error + * Whether or not to throw a drush error if the process fails. Defaults to TRUE. + * + * @return string|void + * The output or error output of the command. */ -function provision_process($command, $cwd = null, $label = 'Process', $env = array(), $log_output = TRUE, $error_message = NULL) { +function provision_process($command, $cwd = null, $label = 'Process', $env = array(), $log_output = TRUE, $error_message = NULL, $throw_drush_error = TRUE) { if (empty($command)) { return; } @@ -481,7 +498,10 @@ function provision_process($command, $cwd = null, $label = 'Process', $env = arr } else { drush_log('', 'p_error'); - drush_set_error('PROVISION_PROCESS_ERROR', dt($error_message)); + + if ($throw_drush_error) { + drush_set_error('PROVISION_PROCESS_ERROR', dt($error_message)); + } return $process->getErrorOutput(); } }