function _drush_backend_get_stdin

8.0.x backend.inc _drush_backend_get_stdin()
6.x backend.inc _drush_backend_get_stdin()
7.x backend.inc _drush_backend_get_stdin()
3.x backend.inc _drush_backend_get_stdin()
4.x backend.inc _drush_backend_get_stdin()
5.x backend.inc _drush_backend_get_stdin()
master backend.inc _drush_backend_get_stdin()

Read options fron STDIN during POST requests.

This function will read any text from the STDIN pipe, and attempts to generate an associative array if valid JSON was received.

Return value

An associative array of options, if successfull. Otherwise FALSE.

1 call to _drush_backend_get_stdin()
_drush_bootstrap_drush in includes/environment.inc
Initial Drush bootstrap phase.

File

includes/backend.inc, line 647
Drush backend API

Code

function _drush_backend_get_stdin() {
  $fp = fopen('php://stdin', 'r');
  stream_set_blocking($fp, FALSE);
  $string = stream_get_contents($fp);
  fclose($fp);
  if (trim($string)) {
    return json_decode($string, TRUE);
  }
  return FALSE;
}