update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
35
pfosten/vendor/symfony/process/Pipes/AbstractPipes.php
vendored
Executable file → Normal file
35
pfosten/vendor/symfony/process/Pipes/AbstractPipes.php
vendored
Executable file → Normal file
|
|
@ -20,21 +20,21 @@ use Symfony\Component\Process\Exception\InvalidArgumentException;
|
|||
*/
|
||||
abstract class AbstractPipes implements PipesInterface
|
||||
{
|
||||
/** @var array */
|
||||
public $pipes = array();
|
||||
|
||||
/** @var string */
|
||||
private $inputBuffer = '';
|
||||
/** @var resource|scalar|\Iterator|null */
|
||||
private $input;
|
||||
/** @var bool */
|
||||
private $blocked = true;
|
||||
private $lastError;
|
||||
|
||||
/**
|
||||
* @param resource|string|int|float|bool|\Iterator|null $input
|
||||
*/
|
||||
public function __construct($input)
|
||||
{
|
||||
if (is_resource($input) || $input instanceof \Iterator) {
|
||||
if (\is_resource($input) || $input instanceof \Iterator) {
|
||||
$this->input = $input;
|
||||
} elseif (is_string($input)) {
|
||||
} elseif (\is_string($input)) {
|
||||
$this->inputBuffer = $input;
|
||||
} else {
|
||||
$this->inputBuffer = (string) $input;
|
||||
|
|
@ -59,10 +59,11 @@ abstract class AbstractPipes implements PipesInterface
|
|||
*/
|
||||
protected function hasSystemCallBeenInterrupted()
|
||||
{
|
||||
$lastError = error_get_last();
|
||||
$lastError = $this->lastError;
|
||||
$this->lastError = null;
|
||||
|
||||
// stream_select returns false when the `select` system call is interrupted by an incoming signal
|
||||
return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
|
||||
return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +78,7 @@ abstract class AbstractPipes implements PipesInterface
|
|||
foreach ($this->pipes as $pipe) {
|
||||
stream_set_blocking($pipe, 0);
|
||||
}
|
||||
if (is_resource($this->input)) {
|
||||
if (\is_resource($this->input)) {
|
||||
stream_set_blocking($this->input, 0);
|
||||
}
|
||||
|
||||
|
|
@ -99,12 +100,12 @@ abstract class AbstractPipes implements PipesInterface
|
|||
if ($input instanceof \Iterator) {
|
||||
if (!$input->valid()) {
|
||||
$input = null;
|
||||
} elseif (is_resource($input = $input->current())) {
|
||||
} elseif (\is_resource($input = $input->current())) {
|
||||
stream_set_blocking($input, 0);
|
||||
} elseif (!isset($this->inputBuffer[0])) {
|
||||
if (!is_string($input)) {
|
||||
if (!\is_string($input)) {
|
||||
if (!is_scalar($input)) {
|
||||
throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', get_class($this->input), gettype($input)));
|
||||
throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', \get_class($this->input), \gettype($input)));
|
||||
}
|
||||
$input = (string) $input;
|
||||
}
|
||||
|
|
@ -120,7 +121,7 @@ abstract class AbstractPipes implements PipesInterface
|
|||
$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)) {
|
||||
if (false === @stream_select($r, $w, $e, 0, 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -166,4 +167,12 @@ abstract class AbstractPipes implements PipesInterface
|
|||
return array($this->pipes[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function handleError($type, $msg)
|
||||
{
|
||||
$this->lastError = $msg;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/Pipes/PipesInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Pipes/PipesInterface.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/Pipes/UnixPipes.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/Pipes/UnixPipes.php
vendored
Executable file → Normal file
|
|
@ -22,11 +22,8 @@ use Symfony\Component\Process\Process;
|
|||
*/
|
||||
class UnixPipes extends AbstractPipes
|
||||
{
|
||||
/** @var bool */
|
||||
private $ttyMode;
|
||||
/** @var bool */
|
||||
private $ptyMode;
|
||||
/** @var bool */
|
||||
private $haveReadSupport;
|
||||
|
||||
public function __construct($ttyMode, $ptyMode, $input, $haveReadSupport)
|
||||
|
|
@ -102,7 +99,9 @@ class UnixPipes extends AbstractPipes
|
|||
unset($r[0]);
|
||||
|
||||
// let's have a look if something changed in streams
|
||||
if (($r || $w) && false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
|
||||
set_error_handler(array($this, 'handleError'));
|
||||
if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
|
||||
restore_error_handler();
|
||||
// if a system call has been interrupted, forget about it, let's try again
|
||||
// otherwise, an error occurred, let's reset pipes
|
||||
if (!$this->hasSystemCallBeenInterrupted()) {
|
||||
|
|
@ -111,6 +110,7 @@ class UnixPipes extends AbstractPipes
|
|||
|
||||
return $read;
|
||||
}
|
||||
restore_error_handler();
|
||||
|
||||
foreach ($r as $pipe) {
|
||||
// prior PHP 5.4 the array passed to stream_select is modified and
|
||||
|
|
|
|||
8
pfosten/vendor/symfony/process/Pipes/WindowsPipes.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/Pipes/WindowsPipes.php
vendored
Executable file → Normal file
|
|
@ -11,8 +11,8 @@
|
|||
|
||||
namespace Symfony\Component\Process\Pipes;
|
||||
|
||||
use Symfony\Component\Process\Process;
|
||||
use Symfony\Component\Process\Exception\RuntimeException;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
/**
|
||||
* WindowsPipes implementation uses temporary files as handles.
|
||||
|
|
@ -26,16 +26,12 @@ use Symfony\Component\Process\Exception\RuntimeException;
|
|||
*/
|
||||
class WindowsPipes extends AbstractPipes
|
||||
{
|
||||
/** @var array */
|
||||
private $files = array();
|
||||
/** @var array */
|
||||
private $fileHandles = array();
|
||||
/** @var array */
|
||||
private $readBytes = array(
|
||||
Process::STDOUT => 0,
|
||||
Process::STDERR => 0,
|
||||
);
|
||||
/** @var bool */
|
||||
private $haveReadSupport;
|
||||
|
||||
public function __construct($input, $haveReadSupport)
|
||||
|
|
@ -145,7 +141,7 @@ class WindowsPipes extends AbstractPipes
|
|||
$data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
|
||||
|
||||
if (isset($data[0])) {
|
||||
$this->readBytes[$type] += strlen($data);
|
||||
$this->readBytes[$type] += \strlen($data);
|
||||
$read[$type] = $data;
|
||||
}
|
||||
if ($close) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue