function drush_backend_packet

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

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


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/
Backend command callback. Add a log message to the log history.
drush_log in includes/
Add a log message to the log history.
drush_set_error in includes/
Set an error code for the error handling system.


includes/, line 213
Drush backend API


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;