Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
71
vendor/symfony/process/Pipes/AbstractPipes.php
vendored
71
vendor/symfony/process/Pipes/AbstractPipes.php
vendored
|
@ -29,6 +29,17 @@ abstract class AbstractPipes implements PipesInterface
|
|||
/** @var bool */
|
||||
private $blocked = true;
|
||||
|
||||
public function __construct($input)
|
||||
{
|
||||
if (is_resource($input)) {
|
||||
$this->input = $input;
|
||||
} elseif (is_string($input)) {
|
||||
$this->inputBuffer = $input;
|
||||
} else {
|
||||
$this->inputBuffer = (string) $input;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -71,4 +82,64 @@ abstract class AbstractPipes implements PipesInterface
|
|||
|
||||
$this->blocked = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes input to stdin.
|
||||
*/
|
||||
protected function write()
|
||||
{
|
||||
if (!isset($this->pipes[0])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$e = array();
|
||||
$r = null !== $this->input ? array($this->input) : $e;
|
||||
$w = array($this->pipes[0]);
|
||||
|
||||
// let's have a look if something changed in streams
|
||||
if (false === $n = @stream_select($r, $w, $e, 0, 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($w as $stdin) {
|
||||
if (isset($this->inputBuffer[0])) {
|
||||
$written = fwrite($stdin, $this->inputBuffer);
|
||||
$this->inputBuffer = substr($this->inputBuffer, $written);
|
||||
if (isset($this->inputBuffer[0])) {
|
||||
return array($this->pipes[0]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($r as $input) {
|
||||
for (;;) {
|
||||
$data = fread($input, self::CHUNK_SIZE);
|
||||
if (!isset($data[0])) {
|
||||
break;
|
||||
}
|
||||
$written = fwrite($stdin, $data);
|
||||
$data = substr($data, $written);
|
||||
if (isset($data[0])) {
|
||||
$this->inputBuffer = $data;
|
||||
|
||||
return array($this->pipes[0]);
|
||||
}
|
||||
}
|
||||
if (!isset($data[0]) && feof($input)) {
|
||||
// no more data to read on input resource
|
||||
// use an empty buffer in the next reads
|
||||
$this->input = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no input to read on resource, buffer is empty
|
||||
if (null === $this->input && !isset($this->inputBuffer[0])) {
|
||||
fclose($this->pipes[0]);
|
||||
unset($this->pipes[0]);
|
||||
}
|
||||
|
||||
if (!$w) {
|
||||
return array($this->pipes[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue