Skip to content

Commit

Permalink
Remove last calls to drush_get_error(). (#3813)
Browse files Browse the repository at this point in the history
  • Loading branch information
weitzman committed Dec 2, 2018
1 parent 3f105ad commit eaf9c3e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion includes/batch.inc
Expand Up @@ -152,7 +152,7 @@ function _drush_backend_batch_process($command = 'batch-process', $args, $option
// Suppress printing stdout since we return a JSON array to the caller there.
$process->run($process->showRealtime()->hideStdout());
$result = $process->getOutputAsJson();
$finished = drush_get_error() || !$process->isSuccessful() || (isset($result['drush_batch_process_finished']) && $result['drush_batch_process_finished'] === TRUE);
$finished = !$process->isSuccessful() || (isset($result['drush_batch_process_finished']) && $result['drush_batch_process_finished'] === TRUE);
}
}

Expand Down
8 changes: 1 addition & 7 deletions includes/preflight.inc
Expand Up @@ -85,11 +85,5 @@ function drush_coverage_shutdown() {
* @deprecated. This function will be removed in Drush 10. Throw an exception to indicate an error.
*/
function drush_return_status() {
// If a specific exit code was set, then use it.
$exit_code = Runtime::exitCode();
if (empty($exit_code)) {
$exit_code = (drush_get_error()) ? DRUSH_FRAMEWORK_ERROR : DRUSH_SUCCESS;
}

exit($exit_code);
exit(Runtime::exitCode());
}
4 changes: 2 additions & 2 deletions src/Boot/BootstrapManager.php
Expand Up @@ -308,15 +308,15 @@ public function doBootstrap($phase, $phase_max = false, AnnotationData $annotati
}
if ($phase_index > $bootstrapped_phase) {
if ($result = $this->bootstrapValidate($phase_index)) {
if (method_exists($bootstrap, $current_phase) && !drush_get_error()) {
if (method_exists($bootstrap, $current_phase)) {
$this->logger->log(LogLevel::BOOTSTRAP, 'Drush bootstrap phase: {function}()', ['function' => $current_phase]);
$bootstrap->{$current_phase}($annotationData);
}
$this->setPhase($phase_index);
}
}
}
return !drush_get_error();
return true;
}

/**
Expand Down
10 changes: 4 additions & 6 deletions src/Commands/core/CacheCommands.php
Expand Up @@ -115,15 +115,10 @@ public function interact($input, $output)
*/
public function set($cid, $data, $bin = 'default', $expire = null, $tags = null, $options = ['input-format' => 'string', 'cache-get' => false])
{
$tags = is_string($tags) ? _convert_csv_to_array($tags) : [];

$tags = is_string($tags) ? StringUtils::csvToArray($tags) : [];
// In addition to prepare, this also validates. Can't easily be in own validate callback as
// reading once from STDIN empties it.
$data = $this->setPrepareData($data, $options);
if ($data === false && drush_get_error()) {
// An error was logged above.
return;
}

if (!isset($expire) || $expire == 'CACHE_PERMANENT') {
$expire = Cache::PERMANENT;
Expand All @@ -142,6 +137,9 @@ protected function setPrepareData($data, $options)
switch ($options['input-format']) {
case 'json':
$data = json_decode($data, true);
if ($data === false) {
throw new \Exception('Unable to parse JSON.');
}
break;
}

Expand Down

0 comments on commit eaf9c3e

Please sign in to comment.