Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.

This commit is contained in:
Pantheon Automation 2015-11-17 13:42:33 -08:00 committed by Greg Anderson
parent 4afb23bbd3
commit 7784f4c23d
929 changed files with 19798 additions and 5304 deletions

View file

@ -56,7 +56,8 @@ class ExecutableFinder
$searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
$dirs = array();
foreach ($searchPath as $path) {
if (is_dir($path)) {
// Silencing against https://bugs.php.net/69240
if (@is_dir($path)) {
$dirs[] = $path;
} else {
if (basename($path) == $name && is_executable($path)) {

View file

@ -21,23 +21,19 @@ use Symfony\Component\Process\Exception\RuntimeException;
* print $p->getOutput()."\n";
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @api
*/
class PhpProcess extends Process
{
/**
* Constructor.
*
* @param string $script The PHP script to run (as a string)
* @param string $cwd The working directory
* @param array $env The environment variables
* @param int $timeout The timeout in seconds
* @param array $options An array of options for proc_open
*
* @api
* @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
* @param int $timeout The timeout in seconds
* @param array $options An array of options for proc_open
*/
public function __construct($script, $cwd = null, array $env = array(), $timeout = 60, array $options = array())
public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
{
$executableFinder = new PhpExecutableFinder();
if (false === $php = $executableFinder->find()) {
@ -49,8 +45,6 @@ class PhpProcess extends Process
/**
* Sets the path to the PHP binary to use.
*
* @api
*/
public function setPhpBinary($php)
{

View file

@ -48,12 +48,11 @@ class WindowsPipes extends AbstractPipes
//
// @see https://bugs.php.net/bug.php?id=51800
$this->files = array(
Process::STDOUT => tempnam(sys_get_temp_dir(), 'sf_proc_stdout'),
Process::STDERR => tempnam(sys_get_temp_dir(), 'sf_proc_stderr'),
Process::STDOUT => tempnam(sys_get_temp_dir(), 'out_sf_proc'),
Process::STDERR => tempnam(sys_get_temp_dir(), 'err_sf_proc'),
);
foreach ($this->files as $offset => $file) {
$this->fileHandles[$offset] = fopen($this->files[$offset], 'rb');
if (false === $this->fileHandles[$offset]) {
if (false === $file || false === $this->fileHandles[$offset] = fopen($file, 'rb')) {
throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
}
}

View file

@ -26,8 +26,6 @@ use Symfony\Component\Process\Pipes\WindowsPipes;
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Romain Neutron <imprec@gmail.com>
*
* @api
*/
class Process
{
@ -133,14 +131,12 @@ class Process
*
* @param string $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 inherit
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
* @param string|null $input The input
* @param int|float|null $timeout The timeout in seconds or null to disable
* @param array $options An array of options for proc_open
*
* @throws RuntimeException When proc_open is not installed
*
* @api
*/
public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
{
@ -200,8 +196,6 @@ class Process
* @throws RuntimeException When process can't be launched
* @throws RuntimeException When process stopped after receiving signal
* @throws LogicException In case a callback is provided and output has been disabled
*
* @api
*/
public function run($callback = null)
{
@ -463,8 +457,6 @@ class Process
*
* @throws LogicException in case the output has been disabled
* @throws LogicException In case the process is not started
*
* @api
*/
public function getOutput()
{
@ -527,8 +519,6 @@ class Process
*
* @throws LogicException in case the output has been disabled
* @throws LogicException In case the process is not started
*
* @api
*/
public function getErrorOutput()
{
@ -591,8 +581,6 @@ class Process
* @return null|int The exit status code, null if the Process is not terminated
*
* @throws RuntimeException In case --enable-sigchild is activated and the sigchild compatibility mode is disabled
*
* @api
*/
public function getExitCode()
{
@ -631,8 +619,6 @@ class Process
* Checks if the process ended successfully.
*
* @return bool true if the process ended successfully, false otherwise
*
* @api
*/
public function isSuccessful()
{
@ -648,8 +634,6 @@ class Process
*
* @throws RuntimeException In case --enable-sigchild is activated
* @throws LogicException In case the process is not terminated
*
* @api
*/
public function hasBeenSignaled()
{
@ -673,8 +657,6 @@ class Process
*
* @throws RuntimeException In case --enable-sigchild is activated
* @throws LogicException In case the process is not terminated
*
* @api
*/
public function getTermSignal()
{
@ -697,8 +679,6 @@ class Process
* @return bool
*
* @throws LogicException In case the process is not terminated
*
* @api
*/
public function hasBeenStopped()
{
@ -717,8 +697,6 @@ class Process
* @return int
*
* @throws LogicException In case the process is not terminated
*
* @api
*/
public function getStopSignal()
{
@ -1052,7 +1030,7 @@ class Process
$this->env = array();
foreach ($env as $key => $value) {
$this->env[(binary) $key] = (binary) $value;
$this->env[$key] = (string) $value;
}
return $this;
@ -1292,7 +1270,7 @@ class Process
*
* @param callable|null $callback The user defined PHP callback
*
* @return callable A PHP callable
* @return \Closure A PHP closure
*/
protected function buildCallback($callback)
{

View file

@ -7,12 +7,13 @@ In this example, we run a simple directory listing and get the result back:
```php
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
$process = new Process('ls -lsa');
$process->setTimeout(3600);
$process->run();
if (!$process->isSuccessful()) {
throw new RuntimeException($process->getErrorOutput());
throw new ProcessFailedException($process);
}
print $process->getOutput();
@ -21,6 +22,19 @@ print $process->getOutput();
You can think that this is easy to achieve with plain PHP but it's not especially
if you want to take care of the subtle differences between the different platforms.
You can simplify the code by using `mustRun()` instead of `run()`, which will
throw a `ProcessFailedException` automatically in case of a problem:
```php
use Symfony\Component\Process\Process;
$process = new Process('ls -lsa');
$process->setTimeout(3600);
$process->mustRun();
print $process->getOutput();
```
And if you want to be able to get some feedback in real-time, just pass an
anonymous function to the ``run()`` method and you will get the output buffer
as it becomes available:

View file

@ -18,9 +18,6 @@
"require": {
"php": ">=5.3.9"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Process\\": "" }
},