composer update
This commit is contained in:
Vendored
+2
-1
@@ -331,7 +331,7 @@ class Process implements \IteratorAggregate
|
||||
}
|
||||
|
||||
if (!is_dir($this->cwd)) {
|
||||
throw new RuntimeException('The provided cwd does not exist.');
|
||||
throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
|
||||
}
|
||||
|
||||
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $options);
|
||||
@@ -419,6 +419,7 @@ class Process implements \IteratorAggregate
|
||||
} while ($running);
|
||||
|
||||
while ($this->isRunning()) {
|
||||
$this->checkTimeout();
|
||||
usleep(1000);
|
||||
}
|
||||
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Process\Tests;
|
||||
|
||||
use Symfony\Component\Process\Exception\ProcessTimedOutException;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
require \dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
list('e' => $php) = getopt('e:') + ['e' => 'php'];
|
||||
|
||||
try {
|
||||
$process = new Process("exec $php -r \"echo 'ready'; trigger_error('error', E_USER_ERROR);\"");
|
||||
$process->start();
|
||||
$process->setTimeout(0.5);
|
||||
while (false === strpos($process->getOutput(), 'ready')) {
|
||||
usleep(1000);
|
||||
}
|
||||
$process->signal(SIGSTOP);
|
||||
$process->wait();
|
||||
|
||||
return $process->getExitCode();
|
||||
} catch (ProcessTimedOutException $t) {
|
||||
echo $t->getMessage().PHP_EOL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
+21
-1
@@ -49,7 +49,8 @@ class ProcessTest extends TestCase
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
|
||||
* @expectedExceptionMessage The provided cwd does not exist.
|
||||
* @expectedExceptionMessage The provided cwd "
|
||||
* @expectedExceptionMessage "does not exist.
|
||||
*/
|
||||
public function testInvalidCwd()
|
||||
{
|
||||
@@ -1510,6 +1511,25 @@ EOTXT;
|
||||
$this->assertSame($env, $p->getEnv());
|
||||
}
|
||||
|
||||
public function testWaitStoppedDeadProcess()
|
||||
{
|
||||
$process = $this->getProcess(self::$phpBin.' '.__DIR__.'/ErrorProcessInitiator.php -e '.self::$phpBin);
|
||||
$process->start();
|
||||
$process->setTimeout(2);
|
||||
$process->wait();
|
||||
$this->assertFalse($process->isRunning());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $commandline
|
||||
* @param string|null $cwd
|
||||
* @param array|null $env
|
||||
* @param string|null $input
|
||||
* @param int $timeout
|
||||
* @param array $options
|
||||
*
|
||||
* @return Process
|
||||
*/
|
||||
private function getProcess($commandline, string $cwd = null, array $env = null, $input = null, ?int $timeout = 60): Process
|
||||
{
|
||||
if (\is_string($commandline)) {
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.2-dev"
|
||||
"dev-master": "4.3-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user