Skip to content

Commit 8e8adcd

Browse files
author
Oliver Lillie
committed
Merge pull request #20 from petewatts/master
Replaced _run recursive call with a while loop. Thanks petewatts.
2 parents 0d677d6 + 28359cf commit 8e8adcd

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

src/PHPVideoToolkit/ExecBuffer.php

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -230,25 +230,26 @@ public function getRunTime()
230230
*/
231231
protected function _run($callback)
232232
{
233-
// get the buffer regardless of wether or not there is a callback as it updates and
234-
// checks for the completion of the command.
235-
$buffer = $this->getBuffer();
236-
237-
// get the buffer to give to the
238-
if($callback !== null && is_callable($callback) === true)
239-
{
240-
call_user_func($callback, $this, $buffer, false);
241-
}
242-
243-
// if we have finished running the loop then break here.
244-
if($this->_running === false)
245-
{
246-
return;
233+
while($this->_running !== false) {
234+
// get the buffer regardless of wether or not there is a callback as it updates and
235+
// checks for the completion of the command.
236+
$buffer = $this->getBuffer();
237+
238+
// get the buffer to give to the
239+
if($callback !== null && is_callable($callback) === true)
240+
{
241+
call_user_func($callback, $this, $buffer, false);
242+
}
243+
244+
// if we have finished running the loop then break here.
245+
if($this->_running === false)
246+
{
247+
break;
248+
}
249+
250+
// still running so wait and then run again.
251+
$this->wait($this->_callback_period_interval);
247252
}
248-
249-
// still running so wait and then run again.
250-
$this->wait($this->_callback_period_interval);
251-
$this->_run($callback);
252253
}
253254

254255
/**

0 commit comments

Comments
 (0)