update2
This commit is contained in:
parent
98419bd18d
commit
8a69e45efa
4919 changed files with 28311 additions and 224136 deletions
0
pfosten/vendor/symfony/process/.gitignore
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/.gitignore
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/process/CHANGELOG.md
vendored
Executable file → Normal file
6
pfosten/vendor/symfony/process/CHANGELOG.md
vendored
Executable file → Normal file
|
|
@ -1,6 +1,12 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
||||
* deprecated the ProcessBuilder class
|
||||
* deprecated calling `Process::start()` without setting a valid working directory beforehand (via `setWorkingDirectory()` or constructor)
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/Exception/ExceptionInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/ExceptionInterface.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/InvalidArgumentException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/InvalidArgumentException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/LogicException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/LogicException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/ProcessFailedException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/ProcessFailedException.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/process/Exception/ProcessTimedOutException.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/process/Exception/ProcessTimedOutException.php
vendored
Executable file → Normal file
|
|
@ -45,12 +45,12 @@ class ProcessTimedOutException extends RuntimeException
|
|||
|
||||
public function isGeneralTimeout()
|
||||
{
|
||||
return $this->timeoutType === self::TYPE_GENERAL;
|
||||
return self::TYPE_GENERAL === $this->timeoutType;
|
||||
}
|
||||
|
||||
public function isIdleTimeout()
|
||||
{
|
||||
return $this->timeoutType === self::TYPE_IDLE;
|
||||
return self::TYPE_IDLE === $this->timeoutType;
|
||||
}
|
||||
|
||||
public function getExceededTimeout()
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/Exception/RuntimeException.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Exception/RuntimeException.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/ExecutableFinder.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/ExecutableFinder.php
vendored
Executable file → Normal file
|
|
@ -23,8 +23,6 @@ class ExecutableFinder
|
|||
|
||||
/**
|
||||
* Replaces default suffixes of executable.
|
||||
*
|
||||
* @param array $suffixes
|
||||
*/
|
||||
public function setSuffixes(array $suffixes)
|
||||
{
|
||||
|
|
@ -73,13 +71,13 @@ class ExecutableFinder
|
|||
}
|
||||
|
||||
$suffixes = array('');
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$pathExt = getenv('PATHEXT');
|
||||
$suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes);
|
||||
$suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
|
||||
}
|
||||
foreach ($suffixes as $suffix) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
|
||||
if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
pfosten/vendor/symfony/process/InputStream.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/process/InputStream.php
vendored
Executable file → Normal file
|
|
@ -20,6 +20,7 @@ use Symfony\Component\Process\Exception\RuntimeException;
|
|||
*/
|
||||
class InputStream implements \IteratorAggregate
|
||||
{
|
||||
/** @var null|callable */
|
||||
private $onEmpty = null;
|
||||
private $input = array();
|
||||
private $open = true;
|
||||
|
|
@ -35,7 +36,8 @@ class InputStream implements \IteratorAggregate
|
|||
/**
|
||||
* Appends an input to the write buffer.
|
||||
*
|
||||
* @param resource|scalar|\Traversable|null The input to append as stream resource, scalar or \Traversable
|
||||
* @param resource|string|int|float|bool|\Traversable|null The input to append as scalar,
|
||||
* stream resource or \Traversable
|
||||
*/
|
||||
public function write($input)
|
||||
{
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/process/LICENSE
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/process/LICENSE
vendored
Executable file → Normal file
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2017 Fabien Potencier
|
||||
Copyright (c) 2004-2018 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
|||
18
pfosten/vendor/symfony/process/PhpExecutableFinder.php
vendored
Executable file → Normal file
18
pfosten/vendor/symfony/process/PhpExecutableFinder.php
vendored
Executable file → Normal file
|
|
@ -39,17 +39,17 @@ class PhpExecutableFinder
|
|||
$args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
|
||||
|
||||
// HHVM support
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
|
||||
}
|
||||
|
||||
// PHP_BINARY return the current sapi executable
|
||||
if (PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
|
||||
if (PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
|
||||
return PHP_BINARY.$args;
|
||||
}
|
||||
|
||||
if ($php = getenv('PHP_PATH')) {
|
||||
if (!is_executable($php)) {
|
||||
if (!@is_executable($php)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -57,13 +57,17 @@ class PhpExecutableFinder
|
|||
}
|
||||
|
||||
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
|
||||
if (is_executable($php)) {
|
||||
if (@is_executable($php)) {
|
||||
return $php;
|
||||
}
|
||||
}
|
||||
|
||||
if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
|
||||
return $php;
|
||||
}
|
||||
|
||||
$dirs = array(PHP_BINDIR);
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$dirs[] = 'C:\xampp\php\\';
|
||||
}
|
||||
|
||||
|
|
@ -79,9 +83,9 @@ class PhpExecutableFinder
|
|||
{
|
||||
$arguments = array();
|
||||
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$arguments[] = '--php';
|
||||
} elseif ('phpdbg' === PHP_SAPI) {
|
||||
} elseif ('phpdbg' === \PHP_SAPI) {
|
||||
$arguments[] = '-qrr';
|
||||
}
|
||||
|
||||
|
|
|
|||
8
pfosten/vendor/symfony/process/PhpProcess.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/PhpProcess.php
vendored
Executable file → Normal file
|
|
@ -25,8 +25,6 @@ use Symfony\Component\Process\Exception\RuntimeException;
|
|||
class PhpProcess extends Process
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $script The PHP script to run (as a string)
|
||||
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
|
||||
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
|
||||
|
|
@ -41,7 +39,7 @@ class PhpProcess extends Process
|
|||
} else {
|
||||
$php = array_merge(array($php), $executableFinder->findArguments());
|
||||
}
|
||||
if ('phpdbg' === PHP_SAPI) {
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$file = tempnam(sys_get_temp_dir(), 'dbg');
|
||||
file_put_contents($file, $script);
|
||||
register_shutdown_function('unlink', $file);
|
||||
|
|
@ -49,7 +47,7 @@ class PhpProcess extends Process
|
|||
$script = null;
|
||||
}
|
||||
if (null !== $options) {
|
||||
@trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
parent::__construct($php, $cwd, $env, $script, $timeout, $options);
|
||||
|
|
@ -71,7 +69,7 @@ class PhpProcess extends Process
|
|||
if (null === $this->getCommandLine()) {
|
||||
throw new RuntimeException('Unable to find the PHP executable.');
|
||||
}
|
||||
$env = 1 < func_num_args() ? func_get_arg(1) : null;
|
||||
$env = 1 < \func_num_args() ? func_get_arg(1) : null;
|
||||
|
||||
parent::start($callback, $env);
|
||||
}
|
||||
|
|
|
|||
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) {
|
||||
|
|
|
|||
163
pfosten/vendor/symfony/process/Process.php
vendored
Executable file → Normal file
163
pfosten/vendor/symfony/process/Process.php
vendored
Executable file → Normal file
|
|
@ -87,8 +87,6 @@ class Process implements \IteratorAggregate
|
|||
* Exit codes translation table.
|
||||
*
|
||||
* User-defined errors must use exit codes in the 64-113 range.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $exitCodes = array(
|
||||
0 => 'OK',
|
||||
|
|
@ -134,8 +132,6 @@ class Process implements \IteratorAggregate
|
|||
);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|array $commandline The command line to run
|
||||
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
|
||||
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
|
||||
|
|
@ -147,7 +143,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = null)
|
||||
{
|
||||
if (!function_exists('proc_open')) {
|
||||
if (!\function_exists('proc_open')) {
|
||||
throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +154,7 @@ class Process implements \IteratorAggregate
|
|||
// on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
|
||||
// @see : https://bugs.php.net/bug.php?id=51800
|
||||
// @see : https://bugs.php.net/bug.php?id=50524
|
||||
if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
|
||||
if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
|
||||
$this->cwd = getcwd();
|
||||
}
|
||||
if (null !== $env) {
|
||||
|
|
@ -167,11 +163,11 @@ class Process implements \IteratorAggregate
|
|||
|
||||
$this->setInput($input);
|
||||
$this->setTimeout($timeout);
|
||||
$this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
|
||||
$this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
|
||||
$this->pty = false;
|
||||
$this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
|
||||
$this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
|
||||
if (null !== $options) {
|
||||
@trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since version 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);
|
||||
$this->options = array_replace($this->options, $options);
|
||||
}
|
||||
}
|
||||
|
|
@ -210,7 +206,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function run($callback = null/*, array $env = array()*/)
|
||||
{
|
||||
$env = 1 < func_num_args() ? func_get_arg(1) : null;
|
||||
$env = 1 < \func_num_args() ? func_get_arg(1) : null;
|
||||
$this->start($callback, $env);
|
||||
|
||||
return $this->wait();
|
||||
|
|
@ -237,7 +233,7 @@ class Process implements \IteratorAggregate
|
|||
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
|
||||
}
|
||||
$env = 1 < func_num_args() ? func_get_arg(1) : null;
|
||||
$env = 1 < \func_num_args() ? func_get_arg(1) : null;
|
||||
|
||||
if (0 !== $this->run($callback, $env)) {
|
||||
throw new ProcessFailedException($this);
|
||||
|
|
@ -271,13 +267,13 @@ class Process implements \IteratorAggregate
|
|||
if ($this->isRunning()) {
|
||||
throw new RuntimeException('Process is already running');
|
||||
}
|
||||
if (2 <= func_num_args()) {
|
||||
if (2 <= \func_num_args()) {
|
||||
$env = func_get_arg(1);
|
||||
} else {
|
||||
if (__CLASS__ !== static::class) {
|
||||
$r = new \ReflectionMethod($this, __FUNCTION__);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[0]->name)) {
|
||||
@trigger_error(sprintf('The %s::start() method expects a second "$env" argument since version 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED);
|
||||
if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[1]->name)) {
|
||||
@trigger_error(sprintf('The %s::start() method expects a second "$env" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
$env = null;
|
||||
|
|
@ -290,10 +286,10 @@ class Process implements \IteratorAggregate
|
|||
$descriptors = $this->getDescriptors();
|
||||
$inheritEnv = $this->inheritEnv;
|
||||
|
||||
if (is_array($commandline = $this->commandline)) {
|
||||
if (\is_array($commandline = $this->commandline)) {
|
||||
$commandline = implode(' ', array_map(array($this, 'escapeArgument'), $commandline));
|
||||
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
// exec is mandatory to deal with sending a signal to the process
|
||||
$commandline = 'exec '.$commandline;
|
||||
}
|
||||
|
|
@ -308,19 +304,16 @@ class Process implements \IteratorAggregate
|
|||
$inheritEnv = true;
|
||||
}
|
||||
|
||||
$envBackup = array();
|
||||
if (null !== $env && $inheritEnv) {
|
||||
foreach ($env as $k => $v) {
|
||||
$envBackup[$k] = getenv($k);
|
||||
putenv(false === $v || null === $v ? $k : "$k=$v");
|
||||
}
|
||||
$env = null;
|
||||
$env += $this->getDefaultEnv();
|
||||
} elseif (null !== $env) {
|
||||
@trigger_error('Not inheriting environment variables is deprecated since Symfony 3.3 and will always happen in 4.0. Set "Process::inheritEnvironmentVariables()" to true instead.', E_USER_DEPRECATED);
|
||||
} else {
|
||||
$env = $this->getDefaultEnv();
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
|
||||
$this->options['bypass_shell'] = true;
|
||||
$commandline = $this->prepareWindowsCommandLine($commandline, $envBackup, $env);
|
||||
$commandline = $this->prepareWindowsCommandLine($commandline, $env);
|
||||
} elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
|
||||
$descriptors[3] = array('pipe', 'w');
|
||||
|
|
@ -333,14 +326,24 @@ class Process implements \IteratorAggregate
|
|||
// @see : https://bugs.php.net/69442
|
||||
$ptsWorkaround = fopen(__FILE__, 'r');
|
||||
}
|
||||
|
||||
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $env, $this->options);
|
||||
|
||||
foreach ($envBackup as $k => $v) {
|
||||
putenv(false === $v ? $k : "$k=$v");
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$envPairs = $env;
|
||||
} else {
|
||||
$envPairs = array();
|
||||
foreach ($env as $k => $v) {
|
||||
if (false !== $v) {
|
||||
$envPairs[] = $k.'='.$v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_resource($this->process)) {
|
||||
if (!is_dir($this->cwd)) {
|
||||
@trigger_error('The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options);
|
||||
|
||||
if (!\is_resource($this->process)) {
|
||||
throw new RuntimeException('Unable to launch a new process.');
|
||||
}
|
||||
$this->status = self::STATUS_STARTED;
|
||||
|
|
@ -380,7 +383,7 @@ class Process implements \IteratorAggregate
|
|||
if ($this->isRunning()) {
|
||||
throw new RuntimeException('Process is already running');
|
||||
}
|
||||
$env = 1 < func_num_args() ? func_get_arg(1) : null;
|
||||
$env = 1 < \func_num_args() ? func_get_arg(1) : null;
|
||||
|
||||
$process = clone $this;
|
||||
$process->start($callback, $env);
|
||||
|
|
@ -419,8 +422,8 @@ class Process implements \IteratorAggregate
|
|||
|
||||
do {
|
||||
$this->checkTimeout();
|
||||
$running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
|
||||
} while ($running);
|
||||
|
||||
while ($this->isRunning()) {
|
||||
|
|
@ -831,7 +834,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function isStarted()
|
||||
{
|
||||
return $this->status != self::STATUS_READY;
|
||||
return self::STATUS_READY != $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -843,7 +846,7 @@ class Process implements \IteratorAggregate
|
|||
{
|
||||
$this->updateStatus(false);
|
||||
|
||||
return $this->status == self::STATUS_TERMINATED;
|
||||
return self::STATUS_TERMINATED == $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -936,7 +939,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function getCommandLine()
|
||||
{
|
||||
return is_array($this->commandline) ? implode(' ', array_map(array($this, 'escapeArgument'), $this->commandline)) : $this->commandline;
|
||||
return \is_array($this->commandline) ? implode(' ', array_map(array($this, 'escapeArgument'), $this->commandline)) : $this->commandline;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1025,7 +1028,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function setTty($tty)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
|
||||
throw new RuntimeException('TTY mode is not supported on Windows platform.');
|
||||
}
|
||||
if ($tty) {
|
||||
|
|
@ -1122,7 +1125,7 @@ class Process implements \IteratorAggregate
|
|||
/**
|
||||
* Sets the environment variables.
|
||||
*
|
||||
* An environment variable value should be a string.
|
||||
* Each environment variable value should be a string.
|
||||
* If it is an array, the variable is ignored.
|
||||
* If it is false or null, it will be removed when
|
||||
* env vars are otherwise inherited.
|
||||
|
|
@ -1138,7 +1141,7 @@ class Process implements \IteratorAggregate
|
|||
{
|
||||
// Process can not handle env values that are arrays
|
||||
$env = array_filter($env, function ($value) {
|
||||
return !is_array($value);
|
||||
return !\is_array($value);
|
||||
});
|
||||
|
||||
$this->env = $env;
|
||||
|
|
@ -1161,7 +1164,7 @@ class Process implements \IteratorAggregate
|
|||
*
|
||||
* This content will be passed to the underlying process standard input.
|
||||
*
|
||||
* @param resource|scalar|\Traversable|null $input The content
|
||||
* @param string|int|float|bool|resource|\Traversable|null $input The content
|
||||
*
|
||||
* @return self The current Process instance
|
||||
*
|
||||
|
|
@ -1187,7 +1190,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->options;
|
||||
}
|
||||
|
|
@ -1203,7 +1206,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
$this->options = $options;
|
||||
|
||||
|
|
@ -1221,7 +1224,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function getEnhanceWindowsCompatibility()
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->enhanceWindowsCompatibility;
|
||||
}
|
||||
|
|
@ -1237,7 +1240,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function setEnhanceWindowsCompatibility($enhance)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Enhanced Windows compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
$this->enhanceWindowsCompatibility = (bool) $enhance;
|
||||
|
||||
|
|
@ -1253,7 +1256,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function getEnhanceSigchildCompatibility()
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->enhanceSigchildCompatibility;
|
||||
}
|
||||
|
|
@ -1273,7 +1276,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function setEnhanceSigchildCompatibility($enhance)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Sigchild compatibility will always be enabled.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
$this->enhanceSigchildCompatibility = (bool) $enhance;
|
||||
|
||||
|
|
@ -1307,7 +1310,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function areEnvironmentVariablesInherited()
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0. Environment variables will always be inherited.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Environment variables will always be inherited.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
return $this->inheritEnv;
|
||||
}
|
||||
|
|
@ -1322,7 +1325,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function checkTimeout()
|
||||
{
|
||||
if ($this->status !== self::STATUS_STARTED) {
|
||||
if (self::STATUS_STARTED !== $this->status) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1352,7 +1355,7 @@ class Process implements \IteratorAggregate
|
|||
return $result;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return $result = false;
|
||||
}
|
||||
|
||||
|
|
@ -1369,7 +1372,7 @@ class Process implements \IteratorAggregate
|
|||
if ($this->input instanceof \Iterator) {
|
||||
$this->input->rewind();
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
|
||||
} else {
|
||||
$this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
|
||||
|
|
@ -1393,7 +1396,7 @@ class Process implements \IteratorAggregate
|
|||
if ($this->outputDisabled) {
|
||||
return function ($type, $data) use ($callback) {
|
||||
if (null !== $callback) {
|
||||
call_user_func($callback, $type, $data);
|
||||
\call_user_func($callback, $type, $data);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1408,7 +1411,7 @@ class Process implements \IteratorAggregate
|
|||
}
|
||||
|
||||
if (null !== $callback) {
|
||||
call_user_func($callback, $type, $data);
|
||||
\call_user_func($callback, $type, $data);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1427,7 +1430,7 @@ class Process implements \IteratorAggregate
|
|||
$this->processInformation = proc_get_status($this->process);
|
||||
$running = $this->processInformation['running'];
|
||||
|
||||
$this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
$this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
|
||||
|
||||
if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
|
||||
$this->processInformation = $this->fallbackStatus + $this->processInformation;
|
||||
|
|
@ -1449,7 +1452,7 @@ class Process implements \IteratorAggregate
|
|||
return self::$sigchild;
|
||||
}
|
||||
|
||||
if (!function_exists('phpinfo') || defined('HHVM_VERSION')) {
|
||||
if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
|
||||
return self::$sigchild = false;
|
||||
}
|
||||
|
||||
|
|
@ -1513,7 +1516,7 @@ class Process implements \IteratorAggregate
|
|||
$callback = $this->callback;
|
||||
foreach ($result as $type => $data) {
|
||||
if (3 !== $type) {
|
||||
$callback($type === self::STDOUT ? self::OUT : self::ERR, $data);
|
||||
$callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
|
||||
} elseif (!isset($this->fallbackStatus['signaled'])) {
|
||||
$this->fallbackStatus['exitcode'] = (int) $data;
|
||||
}
|
||||
|
|
@ -1528,7 +1531,7 @@ class Process implements \IteratorAggregate
|
|||
private function close()
|
||||
{
|
||||
$this->processPipes->close();
|
||||
if (is_resource($this->process)) {
|
||||
if (\is_resource($this->process)) {
|
||||
proc_close($this->process);
|
||||
}
|
||||
$this->exitcode = $this->processInformation['exitcode'];
|
||||
|
|
@ -1593,7 +1596,7 @@ class Process implements \IteratorAggregate
|
|||
return false;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
|
||||
if ($exitCode && $this->isRunning()) {
|
||||
if ($throwException) {
|
||||
|
|
@ -1605,7 +1608,7 @@ class Process implements \IteratorAggregate
|
|||
} else {
|
||||
if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
|
||||
$ok = @proc_terminate($this->process, $signal);
|
||||
} elseif (function_exists('posix_kill')) {
|
||||
} elseif (\function_exists('posix_kill')) {
|
||||
$ok = @posix_kill($pid, $signal);
|
||||
} elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
|
||||
$ok = false === fgets($pipes[2]);
|
||||
|
|
@ -1627,20 +1630,23 @@ class Process implements \IteratorAggregate
|
|||
return true;
|
||||
}
|
||||
|
||||
private function prepareWindowsCommandLine($cmd, array &$envBackup, array &$env = null)
|
||||
private function prepareWindowsCommandLine($cmd, array &$env)
|
||||
{
|
||||
$uid = uniqid('', true);
|
||||
$varCount = 0;
|
||||
$varCache = array();
|
||||
$cmd = preg_replace_callback(
|
||||
'/"(
|
||||
'/"(?:(
|
||||
[^"%!^]*+
|
||||
(?:
|
||||
(?: !LF! | "(?:\^[%!^])?+" )
|
||||
[^"%!^]*+
|
||||
)++
|
||||
)"/x',
|
||||
function ($m) use (&$envBackup, &$env, &$varCache, &$varCount, $uid) {
|
||||
) | [^"]*+ )"/x',
|
||||
function ($m) use (&$env, &$varCache, &$varCount, $uid) {
|
||||
if (!isset($m[1])) {
|
||||
return $m[0];
|
||||
}
|
||||
if (isset($varCache[$m[0]])) {
|
||||
return $varCache[$m[0]];
|
||||
}
|
||||
|
|
@ -1655,13 +1661,7 @@ class Process implements \IteratorAggregate
|
|||
$value = '"'.preg_replace('/(\\\\*)"/', '$1$1\\"', $value).'"';
|
||||
$var = $uid.++$varCount;
|
||||
|
||||
if (null === $env) {
|
||||
putenv("$var=$value");
|
||||
} else {
|
||||
$env[$var] = $value;
|
||||
}
|
||||
|
||||
$envBackup[$var] = false;
|
||||
$env[$var] = $value;
|
||||
|
||||
return $varCache[$m[0]] = '!'.$var.'!';
|
||||
},
|
||||
|
|
@ -1681,7 +1681,7 @@ class Process implements \IteratorAggregate
|
|||
*
|
||||
* @param string $functionName The function name that was called
|
||||
*
|
||||
* @throws LogicException If the process has not run.
|
||||
* @throws LogicException if the process has not run
|
||||
*/
|
||||
private function requireProcessIsStarted($functionName)
|
||||
{
|
||||
|
|
@ -1695,7 +1695,7 @@ class Process implements \IteratorAggregate
|
|||
*
|
||||
* @param string $functionName The function name that was called
|
||||
*
|
||||
* @throws LogicException If the process is not yet terminated.
|
||||
* @throws LogicException if the process is not yet terminated
|
||||
*/
|
||||
private function requireProcessIsTerminated($functionName)
|
||||
{
|
||||
|
|
@ -1713,7 +1713,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
private function escapeArgument($argument)
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
return "'".str_replace("'", "'\\''", $argument)."'";
|
||||
}
|
||||
if ('' === $argument = (string) $argument) {
|
||||
|
|
@ -1729,4 +1729,23 @@ class Process implements \IteratorAggregate
|
|||
|
||||
return '"'.str_replace(array('"', '^', '%', '!', "\n"), array('""', '"^^"', '"^%"', '"^!"', '!LF!'), $argument).'"';
|
||||
}
|
||||
|
||||
private function getDefaultEnv()
|
||||
{
|
||||
$env = array();
|
||||
|
||||
foreach ($_SERVER as $k => $v) {
|
||||
if (\is_string($v) && false !== $v = getenv($k)) {
|
||||
$env[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_ENV as $k => $v) {
|
||||
if (\is_string($v)) {
|
||||
$env[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $env;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
25
pfosten/vendor/symfony/process/ProcessBuilder.php
vendored
Executable file → Normal file
25
pfosten/vendor/symfony/process/ProcessBuilder.php
vendored
Executable file → Normal file
|
|
@ -11,13 +11,15 @@
|
|||
|
||||
namespace Symfony\Component\Process;
|
||||
|
||||
@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the Process class instead.', ProcessBuilder::class), E_USER_DEPRECATED);
|
||||
|
||||
use Symfony\Component\Process\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Process\Exception\LogicException;
|
||||
|
||||
/**
|
||||
* Process builder.
|
||||
*
|
||||
* @author Kris Wallsmith <kris@symfony.com>
|
||||
*
|
||||
* @deprecated since version 3.4, to be removed in 4.0. Use the Process class instead.
|
||||
*/
|
||||
class ProcessBuilder
|
||||
{
|
||||
|
|
@ -32,8 +34,6 @@ class ProcessBuilder
|
|||
private $outputDisabled = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string[] $arguments An array of arguments
|
||||
*/
|
||||
public function __construct(array $arguments = array())
|
||||
|
|
@ -78,7 +78,7 @@ class ProcessBuilder
|
|||
*/
|
||||
public function setPrefix($prefix)
|
||||
{
|
||||
$this->prefix = is_array($prefix) ? $prefix : array($prefix);
|
||||
$this->prefix = \is_array($prefix) ? $prefix : array($prefix);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -120,13 +120,9 @@ class ProcessBuilder
|
|||
* @param bool $inheritEnv
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 3.3, to be removed in 4.0.
|
||||
*/
|
||||
public function inheritEnvironmentVariables($inheritEnv = true)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
$this->inheritEnv = $inheritEnv;
|
||||
|
||||
return $this;
|
||||
|
|
@ -171,7 +167,7 @@ class ProcessBuilder
|
|||
/**
|
||||
* Sets the input of the process.
|
||||
*
|
||||
* @param resource|scalar|\Traversable|null $input The input content
|
||||
* @param resource|string|int|float|bool|\Traversable|null $input The input content
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
|
|
@ -221,13 +217,9 @@ class ProcessBuilder
|
|||
* @param string $value The option value
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated since version 3.3, to be removed in 4.0.
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since version 3.3 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
|
||||
$this->options[$name] = $value;
|
||||
|
||||
return $this;
|
||||
|
|
@ -266,12 +258,15 @@ class ProcessBuilder
|
|||
*/
|
||||
public function getProcess()
|
||||
{
|
||||
if (0 === count($this->prefix) && 0 === count($this->arguments)) {
|
||||
if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
|
||||
throw new LogicException('You must add() command arguments before calling getProcess().');
|
||||
}
|
||||
|
||||
$arguments = array_merge($this->prefix, $this->arguments);
|
||||
$process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options);
|
||||
// to preserve the BC with symfony <3.3, we convert the array structure
|
||||
// to a string structure to avoid the prefixing with the exec command
|
||||
$process->setCommandLine($process->getCommandLine());
|
||||
|
||||
if ($this->inheritEnv) {
|
||||
$process->inheritEnvironmentVariables();
|
||||
|
|
|
|||
10
pfosten/vendor/symfony/process/ProcessUtils.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/process/ProcessUtils.php
vendored
Executable file → Normal file
|
|
@ -40,13 +40,13 @@ class ProcessUtils
|
|||
*/
|
||||
public static function escapeArgument($argument)
|
||||
{
|
||||
@trigger_error('The '.__METHOD__.'() method is deprecated since version 3.3 and will be removed in 4.0. Use a command line array or give env vars to the Process::start/run() method instead.', E_USER_DEPRECATED);
|
||||
@trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use a command line array or give env vars to the Process::start/run() method instead.', E_USER_DEPRECATED);
|
||||
|
||||
//Fix for PHP bug #43784 escapeshellarg removes % from given string
|
||||
//Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
|
||||
//@see https://bugs.php.net/bug.php?id=43784
|
||||
//@see https://bugs.php.net/bug.php?id=49446
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
if ('' === $argument) {
|
||||
return escapeshellarg($argument);
|
||||
}
|
||||
|
|
@ -91,10 +91,10 @@ class ProcessUtils
|
|||
public static function validateInput($caller, $input)
|
||||
{
|
||||
if (null !== $input) {
|
||||
if (is_resource($input)) {
|
||||
if (\is_resource($input)) {
|
||||
return $input;
|
||||
}
|
||||
if (is_string($input)) {
|
||||
if (\is_string($input)) {
|
||||
return $input;
|
||||
}
|
||||
if (is_scalar($input)) {
|
||||
|
|
@ -118,6 +118,6 @@ class ProcessUtils
|
|||
|
||||
private static function isSurroundedBy($arg, $char)
|
||||
{
|
||||
return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
|
||||
return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/README.md
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/README.md
vendored
Executable file → Normal file
46
pfosten/vendor/symfony/process/Tests/ExecutableFinderTest.php
vendored
Executable file → Normal file
46
pfosten/vendor/symfony/process/Tests/ExecutableFinderTest.php
vendored
Executable file → Normal file
|
|
@ -41,7 +41,7 @@ class ExecutableFinderTest extends TestCase
|
|||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
$this->setPath(dirname(PHP_BINARY));
|
||||
$this->setPath(\dirname(PHP_BINARY));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName());
|
||||
|
|
@ -73,7 +73,7 @@ class ExecutableFinderTest extends TestCase
|
|||
|
||||
$this->setPath('');
|
||||
|
||||
$extraDirs = array(dirname(PHP_BINARY));
|
||||
$extraDirs = array(\dirname(PHP_BINARY));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName(), null, $extraDirs);
|
||||
|
|
@ -83,7 +83,7 @@ class ExecutableFinderTest extends TestCase
|
|||
|
||||
public function testFindWithOpenBaseDir()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class ExecutableFinderTest extends TestCase
|
|||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
|
||||
$this->iniSet('open_basedir', dirname(PHP_BINARY).(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
$this->iniSet('open_basedir', \dirname(PHP_BINARY).(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName());
|
||||
|
|
@ -104,12 +104,12 @@ class ExecutableFinderTest extends TestCase
|
|||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
$this->setPath('');
|
||||
$this->iniSet('open_basedir', PHP_BINARY.(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
$this->iniSet('open_basedir', PHP_BINARY.(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : ''));
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find($this->getPhpBinaryName(), false);
|
||||
|
|
@ -117,9 +117,39 @@ class ExecutableFinderTest extends TestCase
|
|||
$this->assertSamePath(PHP_BINARY, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 5.4
|
||||
*/
|
||||
public function testFindBatchExecutableOnWindows()
|
||||
{
|
||||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Can be only tested on windows');
|
||||
}
|
||||
|
||||
$target = tempnam(sys_get_temp_dir(), 'example-windows-executable');
|
||||
|
||||
touch($target);
|
||||
touch($target.'.BAT');
|
||||
|
||||
$this->assertFalse(is_executable($target));
|
||||
|
||||
$this->setPath(sys_get_temp_dir());
|
||||
|
||||
$finder = new ExecutableFinder();
|
||||
$result = $finder->find(basename($target), false);
|
||||
|
||||
unlink($target);
|
||||
unlink($target.'.BAT');
|
||||
|
||||
$this->assertSamePath($target.'.BAT', $result);
|
||||
}
|
||||
|
||||
private function assertSamePath($expected, $tested)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals(strtolower($expected), strtolower($tested));
|
||||
} else {
|
||||
$this->assertEquals($expected, $tested);
|
||||
|
|
@ -128,6 +158,6 @@ class ExecutableFinderTest extends TestCase
|
|||
|
||||
private function getPhpBinaryName()
|
||||
{
|
||||
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
return basename(PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/Tests/NonStopableProcess.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Tests/NonStopableProcess.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/process/Tests/PhpExecutableFinderTest.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/process/Tests/PhpExecutableFinderTest.php
vendored
Executable file → Normal file
|
|
@ -24,14 +24,14 @@ class PhpExecutableFinderTest extends TestCase
|
|||
*/
|
||||
public function testFind()
|
||||
{
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped('Should not be executed in HHVM context.');
|
||||
}
|
||||
|
||||
$f = new PhpExecutableFinder();
|
||||
|
||||
$current = PHP_BINARY;
|
||||
$args = 'phpdbg' === PHP_SAPI ? ' -qrr' : '';
|
||||
$args = 'phpdbg' === \PHP_SAPI ? ' -qrr' : '';
|
||||
|
||||
$this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP');
|
||||
$this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
|
||||
|
|
@ -42,7 +42,7 @@ class PhpExecutableFinderTest extends TestCase
|
|||
*/
|
||||
public function testFindWithHHVM()
|
||||
{
|
||||
if (!defined('HHVM_VERSION')) {
|
||||
if (!\defined('HHVM_VERSION')) {
|
||||
$this->markTestSkipped('Should be executed in HHVM context.');
|
||||
}
|
||||
|
||||
|
|
@ -61,9 +61,9 @@ class PhpExecutableFinderTest extends TestCase
|
|||
{
|
||||
$f = new PhpExecutableFinder();
|
||||
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments');
|
||||
} elseif ('phpdbg' === PHP_SAPI) {
|
||||
} elseif ('phpdbg' === \PHP_SAPI) {
|
||||
$this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments');
|
||||
} else {
|
||||
$this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments');
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/process/Tests/PhpProcessTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/process/Tests/PhpProcessTest.php
vendored
Executable file → Normal file
|
|
@ -43,6 +43,6 @@ PHP
|
|||
$process->wait();
|
||||
$this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
|
||||
|
||||
$this->assertSame(phpversion().PHP_SAPI, $process->getOutput());
|
||||
$this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
8
pfosten/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php
vendored
Executable file → Normal file
8
pfosten/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php
vendored
Executable file → Normal file
|
|
@ -35,22 +35,22 @@ while ($read || $write) {
|
|||
}
|
||||
|
||||
if (in_array(STDOUT, $w) && strlen($out) > 0) {
|
||||
$written = fwrite(STDOUT, (binary) $out, 32768);
|
||||
$written = fwrite(STDOUT, (string) $out, 32768);
|
||||
if (false === $written) {
|
||||
die(ERR_WRITE_FAILED);
|
||||
}
|
||||
$out = (binary) substr($out, $written);
|
||||
$out = (string) substr($out, $written);
|
||||
}
|
||||
if (null === $read && '' === $out) {
|
||||
$write = array_diff($write, array(STDOUT));
|
||||
}
|
||||
|
||||
if (in_array(STDERR, $w) && strlen($err) > 0) {
|
||||
$written = fwrite(STDERR, (binary) $err, 32768);
|
||||
$written = fwrite(STDERR, (string) $err, 32768);
|
||||
if (false === $written) {
|
||||
die(ERR_WRITE_FAILED);
|
||||
}
|
||||
$err = (binary) substr($err, $written);
|
||||
$err = (string) substr($err, $written);
|
||||
}
|
||||
if (null === $read && '' === $err) {
|
||||
$write = array_diff($write, array(STDERR));
|
||||
|
|
|
|||
35
pfosten/vendor/symfony/process/Tests/ProcessBuilderTest.php
vendored
Executable file → Normal file
35
pfosten/vendor/symfony/process/Tests/ProcessBuilderTest.php
vendored
Executable file → Normal file
|
|
@ -14,11 +14,11 @@ namespace Symfony\Component\Process\Tests;
|
|||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
class ProcessBuilderTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testInheritEnvironmentVars()
|
||||
{
|
||||
$proc = ProcessBuilder::create()
|
||||
|
|
@ -90,14 +90,14 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb->setPrefix('/usr/bin/php');
|
||||
|
||||
$proc = $pb->setArguments(array('-v'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" -v', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' '-v'", $proc->getCommandLine());
|
||||
}
|
||||
|
||||
$proc = $pb->setArguments(array('-i'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" -i', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' '-i'", $proc->getCommandLine());
|
||||
|
|
@ -110,14 +110,14 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb->setPrefix(array('/usr/bin/php', 'composer.phar'));
|
||||
|
||||
$proc = $pb->setArguments(array('-v'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" composer.phar -v', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' 'composer.phar' '-v'", $proc->getCommandLine());
|
||||
}
|
||||
|
||||
$proc = $pb->setArguments(array('-i'))->getProcess();
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php" composer.phar -i', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php' 'composer.phar' '-i'", $proc->getCommandLine());
|
||||
|
|
@ -129,7 +129,7 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb = new ProcessBuilder(array('%path%', 'foo " bar', '%baz%baz'));
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('""^%"path"^%"" "foo "" bar" ""^%"baz"^%"baz"', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%path%' 'foo \" bar' '%baz%baz'", $proc->getCommandLine());
|
||||
|
|
@ -142,7 +142,7 @@ class ProcessBuilderTest extends TestCase
|
|||
$pb->setPrefix('%prefix%');
|
||||
$proc = $pb->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertSame('""^%"prefix"^%"" arg', $proc->getCommandLine());
|
||||
} else {
|
||||
$this->assertSame("'%prefix%' 'arg'", $proc->getCommandLine());
|
||||
|
|
@ -163,7 +163,7 @@ class ProcessBuilderTest extends TestCase
|
|||
->setPrefix('/usr/bin/php')
|
||||
->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
|
|
@ -175,7 +175,7 @@ class ProcessBuilderTest extends TestCase
|
|||
$process = ProcessBuilder::create(array('/usr/bin/php'))
|
||||
->getProcess();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals('"/usr/bin/php"', $process->getCommandLine());
|
||||
} else {
|
||||
$this->assertEquals("'/usr/bin/php'", $process->getCommandLine());
|
||||
|
|
@ -210,4 +210,17 @@ class ProcessBuilderTest extends TestCase
|
|||
$builder = ProcessBuilder::create();
|
||||
$builder->setInput(array());
|
||||
}
|
||||
|
||||
public function testDoesNotPrefixExec()
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
$builder = ProcessBuilder::create(array('command', '-v', 'ls'));
|
||||
$process = $builder->getProcess();
|
||||
$process->run();
|
||||
|
||||
$this->assertTrue($process->isSuccessful());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
pfosten/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php
vendored
Executable file → Normal file
10
pfosten/vendor/symfony/process/Tests/ProcessFailedExceptionTest.php
vendored
Executable file → Normal file
|
|
@ -29,10 +29,12 @@ class ProcessFailedExceptionTest extends TestCase
|
|||
->method('isSuccessful')
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}(
|
||||
'\InvalidArgumentException',
|
||||
'Expected a failed process, but the given process was successful.'
|
||||
);
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('Expected a failed process, but the given process was successful.');
|
||||
} else {
|
||||
$this->setExpectedException(\InvalidArgumentException::class, 'Expected a failed process, but the given process was successful.');
|
||||
}
|
||||
|
||||
new ProcessFailedException($process);
|
||||
}
|
||||
|
|
|
|||
108
pfosten/vendor/symfony/process/Tests/ProcessTest.php
vendored
Executable file → Normal file
108
pfosten/vendor/symfony/process/Tests/ProcessTest.php
vendored
Executable file → Normal file
|
|
@ -33,7 +33,7 @@ class ProcessTest extends TestCase
|
|||
public static function setUpBeforeClass()
|
||||
{
|
||||
$phpBin = new PhpExecutableFinder();
|
||||
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === PHP_SAPI ? 'php' : $phpBin->find());
|
||||
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find());
|
||||
|
||||
ob_start();
|
||||
phpinfo(INFO_GENERAL);
|
||||
|
|
@ -48,9 +48,27 @@ class ProcessTest extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The provided cwd does not exist. Command is currently ran against getcwd(). This behavior is deprecated since Symfony 3.4 and will be removed in 4.0.
|
||||
*/
|
||||
public function testInvalidCwd()
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('False-positive on Windows/appveyor.');
|
||||
}
|
||||
|
||||
// Check that it works fine if the CWD exists
|
||||
$cmd = new Process('echo test', __DIR__);
|
||||
$cmd->run();
|
||||
|
||||
$cmd = new Process('echo test', __DIR__.'/notfound/');
|
||||
$cmd->run();
|
||||
}
|
||||
|
||||
public function testThatProcessDoesNotThrowWarningDuringRun()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is transient on Windows');
|
||||
}
|
||||
@trigger_error('Test Error', E_USER_NOTICE);
|
||||
|
|
@ -140,7 +158,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
$o = $p->getOutput();
|
||||
|
||||
$this->assertEquals($expectedOutputSize, strlen($o));
|
||||
$this->assertEquals($expectedOutputSize, \strlen($o));
|
||||
}
|
||||
|
||||
public function testCallbacksAreExecutedWithStart()
|
||||
|
|
@ -182,8 +200,8 @@ class ProcessTest extends TestCase
|
|||
$p->setInput($expected);
|
||||
$p->run();
|
||||
|
||||
$this->assertEquals($expectedLength, strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, strlen($p->getErrorOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -204,8 +222,8 @@ class ProcessTest extends TestCase
|
|||
|
||||
fclose($stream);
|
||||
|
||||
$this->assertEquals($expectedLength, strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, strlen($p->getErrorOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getOutput()));
|
||||
$this->assertEquals($expectedLength, \strlen($p->getErrorOutput()));
|
||||
}
|
||||
|
||||
public function testLiveStreamAsInput()
|
||||
|
|
@ -285,7 +303,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function chainedCommandsOutputProvider()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array("2 \r\n2\r\n", '&&', '2'),
|
||||
);
|
||||
|
|
@ -313,7 +331,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
$called = false;
|
||||
$p->run(function ($type, $buffer) use (&$called) {
|
||||
$called = $buffer === 'foo';
|
||||
$called = 'foo' === $buffer;
|
||||
});
|
||||
|
||||
$this->assertTrue($called, 'The callback should be executed with the output');
|
||||
|
|
@ -326,7 +344,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
$called = false;
|
||||
$p->run(function ($type, $buffer) use (&$called) {
|
||||
$called = $buffer === 'foo';
|
||||
$called = 'foo' === $buffer;
|
||||
});
|
||||
|
||||
$this->assertTrue($called, 'The callback should be executed with the output');
|
||||
|
|
@ -404,7 +422,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testZeroAsOutput()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
// see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line
|
||||
$p = $this->getProcess('echo | set /p dummyName=0');
|
||||
} else {
|
||||
|
|
@ -417,7 +435,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testExitCodeCommandFailed()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX exit code');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -429,9 +447,12 @@ class ProcessTest extends TestCase
|
|||
$this->assertGreaterThan(0, $process->getExitCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group tty
|
||||
*/
|
||||
public function testTTYCommand()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not have /dev/tty support');
|
||||
}
|
||||
|
||||
|
|
@ -444,9 +465,12 @@ class ProcessTest extends TestCase
|
|||
$this->assertSame(Process::STATUS_TERMINATED, $process->getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group tty
|
||||
*/
|
||||
public function testTTYCommandExitCode()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does have /dev/tty support');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -464,7 +488,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testTTYInWindowsEnvironment()
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is for Windows platform only');
|
||||
}
|
||||
|
||||
|
|
@ -551,7 +575,7 @@ class ProcessTest extends TestCase
|
|||
{
|
||||
$process = $this->getProcess('echo foo');
|
||||
$process->run();
|
||||
$this->assertTrue(strlen($process->getOutput()) > 0);
|
||||
$this->assertGreaterThan(0, \strlen($process->getOutput()));
|
||||
}
|
||||
|
||||
public function testGetExitCodeIsNullOnStart()
|
||||
|
|
@ -650,7 +674,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessIsNotSignaled()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -662,7 +686,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessWithoutTermSignal()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -674,7 +698,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessIsSignaledIfStopped()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild();
|
||||
|
|
@ -692,7 +716,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testProcessThrowsExceptionWhenExternallySignaled()
|
||||
{
|
||||
if (!function_exists('posix_kill')) {
|
||||
if (!\function_exists('posix_kill')) {
|
||||
$this->markTestSkipped('Function posix_kill is required.');
|
||||
}
|
||||
$this->skipIfNotEnhancedSigchild(false);
|
||||
|
|
@ -996,7 +1020,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testWrongSignal($signal)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
|
|
@ -1159,7 +1183,7 @@ class ProcessTest extends TestCase
|
|||
'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';',
|
||||
);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
// Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650
|
||||
$sizes = array(1, 2, 4, 8);
|
||||
} else {
|
||||
|
|
@ -1219,7 +1243,7 @@ class ProcessTest extends TestCase
|
|||
{
|
||||
$input = new InputStream();
|
||||
|
||||
$process = $this->getProcessForCode('echo \'ping\'; stream_copy_to_stream(STDIN, STDOUT);');
|
||||
$process = $this->getProcessForCode('echo \'ping\'; echo fread(STDIN, 4); echo fread(STDIN, 4);');
|
||||
$process->setInput($input);
|
||||
|
||||
$process->start(function ($type, $data) use ($input) {
|
||||
|
|
@ -1400,6 +1424,7 @@ class ProcessTest extends TestCase
|
|||
public function testEnvBackupDoesNotDeleteExistingVars()
|
||||
{
|
||||
putenv('existing_var=foo');
|
||||
$_ENV['existing_var'] = 'foo';
|
||||
$process = $this->getProcess('php -r "echo getenv(\'new_test_var\');"');
|
||||
$process->setEnv(array('existing_var' => 'bar', 'new_test_var' => 'foo'));
|
||||
$process->inheritEnvironmentVariables();
|
||||
|
|
@ -1409,20 +1434,27 @@ class ProcessTest extends TestCase
|
|||
$this->assertSame('foo', $process->getOutput());
|
||||
$this->assertSame('foo', getenv('existing_var'));
|
||||
$this->assertFalse(getenv('new_test_var'));
|
||||
|
||||
putenv('existing_var');
|
||||
unset($_ENV['existing_var']);
|
||||
}
|
||||
|
||||
public function testEnvIsInherited()
|
||||
{
|
||||
$process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ'));
|
||||
$process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ', 'EMPTY' => ''));
|
||||
|
||||
putenv('FOO=BAR');
|
||||
$_ENV['FOO'] = 'BAR';
|
||||
|
||||
$process->run();
|
||||
|
||||
$expected = array('BAR' => 'BAZ', 'FOO' => 'BAR');
|
||||
$expected = array('BAR' => 'BAZ', 'EMPTY' => '', 'FOO' => 'BAR');
|
||||
$env = array_intersect_key(unserialize($process->getOutput()), $expected);
|
||||
|
||||
$this->assertEquals($expected, $env);
|
||||
|
||||
putenv('FOO');
|
||||
unset($_ENV['FOO']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1433,6 +1465,7 @@ class ProcessTest extends TestCase
|
|||
$process = $this->getProcessForCode('echo serialize($_SERVER);', null, array('BAR' => 'BAZ'));
|
||||
|
||||
putenv('FOO=BAR');
|
||||
$_ENV['FOO'] = 'BAR';
|
||||
|
||||
$this->assertSame($process, $process->inheritEnvironmentVariables(false));
|
||||
$this->assertFalse($process->areEnvironmentVariablesInherited());
|
||||
|
|
@ -1444,13 +1477,16 @@ class ProcessTest extends TestCase
|
|||
unset($expected['FOO']);
|
||||
|
||||
$this->assertSame($expected, $env);
|
||||
|
||||
putenv('FOO');
|
||||
unset($_ENV['FOO']);
|
||||
}
|
||||
|
||||
public function testGetCommandLine()
|
||||
{
|
||||
$p = new Process(array('/usr/bin/php'));
|
||||
|
||||
$expected = '\\' === DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
|
||||
$expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
|
||||
$this->assertSame($expected, $p->getCommandLine());
|
||||
}
|
||||
|
||||
|
|
@ -1478,6 +1514,24 @@ class ProcessTest extends TestCase
|
|||
$this->assertSame($arg, $p->getOutput());
|
||||
}
|
||||
|
||||
public function testRawCommandLine()
|
||||
{
|
||||
$p = new Process(sprintf('"%s" -r %s "a" "" "b"', self::$phpBin, escapeshellarg('print_r($argv);')));
|
||||
$p->run();
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Array
|
||||
(
|
||||
[0] => -
|
||||
[1] => a
|
||||
[2] =>
|
||||
[3] => b
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertSame($expected, str_replace('Standard input code', '-', $p->getOutput()));
|
||||
}
|
||||
|
||||
public function provideEscapeArgument()
|
||||
{
|
||||
yield array('a"b%c%');
|
||||
|
|
@ -1492,7 +1546,7 @@ class ProcessTest extends TestCase
|
|||
public function testEnvArgument()
|
||||
{
|
||||
$env = array('FOO' => 'Foo', 'BAR' => 'Bar');
|
||||
$cmd = '\\' === DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
|
||||
$cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
|
||||
$p = new Process($cmd, null, $env);
|
||||
$p->run(null, array('BAR' => 'baR', 'BAZ' => 'baZ'));
|
||||
|
||||
|
|
|
|||
2
pfosten/vendor/symfony/process/Tests/ProcessUtilsTest.php
vendored
Executable file → Normal file
2
pfosten/vendor/symfony/process/Tests/ProcessUtilsTest.php
vendored
Executable file → Normal file
|
|
@ -29,7 +29,7 @@ class ProcessUtilsTest extends TestCase
|
|||
|
||||
public function dataArguments()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array('"\"php\" \"-v\""', '"php" "-v"'),
|
||||
array('"foo bar"', 'foo bar'),
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/Tests/SignalListener.php
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/Tests/SignalListener.php
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/process/composer.json
vendored
Executable file → Normal file
4
pfosten/vendor/symfony/process/composer.json
vendored
Executable file → Normal file
|
|
@ -16,7 +16,7 @@
|
|||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\Process\\": "" },
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.3-dev"
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
0
pfosten/vendor/symfony/process/phpunit.xml.dist
vendored
Executable file → Normal file
0
pfosten/vendor/symfony/process/phpunit.xml.dist
vendored
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue