Skip to content

Commit

Permalink
[Process] Fix for #8754 (Timed-out processes are successful)
Browse files Browse the repository at this point in the history
  • Loading branch information
romainneutron authored and fabpot committed Aug 14, 2013
1 parent 4af7276 commit fa01e6b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Process/Process.php
Expand Up @@ -646,9 +646,9 @@ public function stop($timeout = 10, $signal = null)
$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')) {
Expand Down
Expand Up @@ -444,6 +444,7 @@ public function testCheckTimeoutOnStartedProcess()
$duration = microtime(true) - $start;

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

public function testGetPid()
Expand Down
Expand Up @@ -61,6 +61,14 @@ public function testProcessWithoutTermSignal()
parent::testProcessWithoutTermSignal();
}

/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/
public function testCheckTimeoutOnStartedProcess()
{
parent::testCheckTimeoutOnStartedProcess();
}

/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
*/
Expand Down

0 comments on commit fa01e6b

Please sign in to comment.