merged branch romainneutron/fix-8754 (PR #8756)

This PR was squashed before being merged into the 2.3 branch (closes #8756).

Discussion
----------

[Process] Fix for #8754 (Timed-out processes are successful)

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8754
| License       | MIT

Commits
-------

fa01e6b [Process] Fix for #8754 (Timed-out processes are successful)
This commit is contained in:
Fabien Potencier 2013-08-15 00:22:46 +02:00
commit e6d0e693fa
3 changed files with 11 additions and 2 deletions

View File

@ -646,9 +646,9 @@ class Process
$timeoutMicro = microtime(true) + $timeout;
if ($this->isRunning()) {
proc_terminate($this->process);
while ($this->isRunning() && microtime(true) < $timeoutMicro) {
do {
usleep(1000);
}
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
if ($this->isRunning() && !$this->isSigchildEnabled()) {
if (null !== $signal || defined('SIGKILL')) {

View File

@ -444,6 +444,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
$duration = microtime(true) - $start;
$this->assertLessThan($timeout + $precision, $duration);
$this->assertFalse($process->isSuccessful());
}
public function testGetPid()

View File

@ -61,6 +61,14 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
parent::testProcessWithoutTermSignal();
}
/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/
public function testCheckTimeoutOnStartedProcess()
{
parent::testCheckTimeoutOnStartedProcess();
}
/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/