Skip to content

Commit

Permalink
[Process] Add more precision to Process::stop timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
romainneutron committed Aug 13, 2013
1 parent 57d4159 commit fa769a2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Symfony/Component/Process/Process.php
Expand Up @@ -631,12 +631,10 @@ public function getStatus()
*/
public function stop($timeout = 10)
{
$timeoutMicro = (int) $timeout*1E6;
$timeoutMicro = microtime(true) + $timeout;
if ($this->isRunning()) {
proc_terminate($this->process);
$time = 0;
while (1 == $this->isRunning() && $time < $timeoutMicro) {
$time += 1000;
while ($this->isRunning() && microtime(true) < $timeoutMicro) {
usleep(1000);
}

Expand Down

0 comments on commit fa769a2

Please sign in to comment.