Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa01e6b

Browse files
romainneutronfabpot
authored andcommitted
[Process] Fix for #8754 (Timed-out processes are successful)
1 parent 4af7276 commit fa01e6b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,9 @@ public function stop($timeout = 10, $signal = null)
646646
$timeoutMicro = microtime(true) + $timeout;
647647
if ($this->isRunning()) {
648648
proc_terminate($this->process);
649-
while ($this->isRunning() && microtime(true) < $timeoutMicro) {
649+
do {
650650
usleep(1000);
651-
}
651+
} while ($this->isRunning() && microtime(true) < $timeoutMicro);
652652

653653
if ($this->isRunning() && !$this->isSigchildEnabled()) {
654654
if (null !== $signal || defined('SIGKILL')) {

src/Symfony/Component/Process/Tests/AbstractProcessTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ public function testCheckTimeoutOnStartedProcess()
444444
$duration = microtime(true) - $start;
445445

446446
$this->assertLessThan($timeout + $precision, $duration);
447+
$this->assertFalse($process->isSuccessful());
447448
}
448449

449450
public function testGetPid()

src/Symfony/Component/Process/Tests/SigchildDisabledProcessTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ public function testProcessWithoutTermSignal()
6161
parent::testProcessWithoutTermSignal();
6262
}
6363

64+
/**
65+
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
66+
*/
67+
public function testCheckTimeoutOnStartedProcess()
68+
{
69+
parent::testCheckTimeoutOnStartedProcess();
70+
}
71+
6472
/**
6573
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
6674
*/

0 commit comments

Comments
 (0)