function drush_backend_output

8.0.x drush_backend_output()
6.x drush_backend_output()
7.x drush_backend_output()
3.x drush_backend_output()
4.x drush_backend_output()
5.x drush_backend_output()
master drush_backend_output()

Print the json-encoded output of this command, including the encoded log records, context information, etc.

2 calls to drush_backend_output()
drush_shutdown in includes/
Shutdown function for use while Drupal is bootstrapping and to return any registered errors.
drush_unit_batch in tests/
Command callback.


includes/, line 134
Drush backend API


function drush_backend_output() {
  $data = array();

  if (drush_get_context('DRUSH_PIPE')) {
    $pipe = drush_get_context('DRUSH_PIPE_BUFFER');
    $data['output'] = $pipe; // print_r($pipe, TRUE);
  else {
    // Strip out backend commands.
    $packet_regex = strtr(sprintf(DRUSH_BACKEND_PACKET_PATTERN, "([^\0]*)"), array("\0" => "\\0"));
    $data['output'] = preg_replace("/$packet_regex/s", '', drush_backend_output_collect(NULL));

  if (drush_get_context('DRUSH_QUIET', FALSE)) {

  $result_object = drush_backend_get_result();
  if (isset($result_object)) {
    $data['object'] = $result_object;

  $error = drush_get_error();
  $data['error_status'] = ($error) ? $error : DRUSH_SUCCESS;

  $data['log'] = drush_get_log(); // Append logging information
  // The error log is a more specific version of the log, and may be used by calling
  // scripts to check for specific errors that have occurred.
  $data['error_log'] = drush_get_error_log();
  // If there is a @self record, then include it in the result
  $self_record = drush_sitealias_get_record('@self');
  if (!empty($self_record)) {
    $site_context = drush_get_context('site', array());
    $data['self'] = array_merge($site_context, $self_record);

  // Return the options that were set at the end of the process.
  $data['context'] = drush_get_merged_options();
  printf("\0" . DRUSH_BACKEND_OUTPUT_DELIMITER, json_encode($data));