function drush_backend_packet

8.0.x backend.inc drush_backend_packet($packet, $data)
6.x backend.inc drush_backend_packet($packet, $data)
7.x backend.inc drush_backend_packet($packet, $data)
5.x backend.inc drush_backend_packet($packet, $data)
master backend.inc drush_backend_packet($packet, $data)

Output a backend packet if we're running as backend.

Parameters

packet: The packet to send.

data: Data for the command.

Return value

A boolean indicating whether the command was output.

3 calls to drush_backend_packet()
drush_backend_packet_log in includes/drush.inc
Backend command callback. Add a log message to the log history.
drush_log in includes/drush.inc
Add a log message to the log history.
drush_set_error in includes/drush.inc
Set an error code for the error handling system.

File

includes/backend.inc, line 213
Drush backend API

Code

function drush_backend_packet($packet, $data) {
  if (drush_get_context('DRUSH_BACKEND')) {
    $data['packet'] = $packet;
    $data = json_encode($data);
    // We use 'fwrite' instead of 'drush_print' here because
    // this backend packet is out-of-band data.
    fwrite(STDERR, sprintf(DRUSH_BACKEND_PACKET_PATTERN, $data));
    return TRUE;
  }

  return FALSE;
}