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:
commit
e6d0e693fa
@ -646,9 +646,9 @@ class Process
|
|||||||
$timeoutMicro = microtime(true) + $timeout;
|
$timeoutMicro = microtime(true) + $timeout;
|
||||||
if ($this->isRunning()) {
|
if ($this->isRunning()) {
|
||||||
proc_terminate($this->process);
|
proc_terminate($this->process);
|
||||||
while ($this->isRunning() && microtime(true) < $timeoutMicro) {
|
do {
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
|
||||||
|
|
||||||
if ($this->isRunning() && !$this->isSigchildEnabled()) {
|
if ($this->isRunning() && !$this->isSigchildEnabled()) {
|
||||||
if (null !== $signal || defined('SIGKILL')) {
|
if (null !== $signal || defined('SIGKILL')) {
|
||||||
|
@ -444,6 +444,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$duration = microtime(true) - $start;
|
$duration = microtime(true) - $start;
|
||||||
|
|
||||||
$this->assertLessThan($timeout + $precision, $duration);
|
$this->assertLessThan($timeout + $precision, $duration);
|
||||||
|
$this->assertFalse($process->isSuccessful());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPid()
|
public function testGetPid()
|
||||||
|
@ -61,6 +61,14 @@ class SigchildDisabledProcessTest extends AbstractProcessTest
|
|||||||
parent::testProcessWithoutTermSignal();
|
parent::testProcessWithoutTermSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
|
||||||
|
*/
|
||||||
|
public function testCheckTimeoutOnStartedProcess()
|
||||||
|
{
|
||||||
|
parent::testCheckTimeoutOnStartedProcess();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
|
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user