I'm having a wierd issue implementing a very simple test of the
ZendX_Console_Process_Unix class. Basically my process instance executes but
it never updates the isRunning property so my monitoring loop never
terminates. More over, its seems that my custom process class looses
references to itself. Check out the following code:



require_once("../library/ZendX/Console/Process/Unix.php");

class MyProcess extends ZendX_Console_Process_Unix
{
    protected function _run()
    {
        for ($i = 0; $i < 5; $i++) {
            echo "___Process: pid=".$this->getPid().",
isRunning=".$this->isRunning()." \n";
            sleep(1);
        }
    }
}

$process1 = new MyProcess();
$process1->start();

while ($process1->isRunning()) {
    echo "Controller: pid=".$process1->getPid().",
isRunning=".$process1->isRunning()."\n";
    sleep(1);
}

echo "All tasked completed\n";


The above results in the following console output:

u...@debian:~/web/app/task$ php5 index.php 
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
___Process: pid=, isRunning= 
Controller: pid=3969, isRunning=1
___Process: pid=, isRunning= 
Controller: pid=3969, isRunning=1
___Process: pid=, isRunning= 
Controller: pid=3969, isRunning=1
___Process: pid=, isRunning= 
Controller: pid=3969, isRunning=1
___Process: pid=, isRunning= 
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
Controller: pid=3969, isRunning=1
^C
u...@debian:~/web/app/task$


>From the above you can notice that the process class seems to report null
when calling the getPid and isRunning fuctions. The main controller loop
never terminates, as the isRunning value from that instance never changes. I
also have a quick screencast of this code executing while I monitor it with
top, your can check it out:  http://screencast.com/t/i5riU5rhb
http://screencast.com/t/i5riU5rhb 

The child process runs and terminates but values that the controlling loop
sees never change. And within the instance itself eveything seems null. I've
been banging my head on this for a little while. Any ideas people may have
would be greatly appreciated.

Thanks

PS  http://www.nabble.com/file/p23771999/phpinfo.txt Here is a dump of my
php -i command 
-- 
View this message in context: 
http://www.nabble.com/ZendX_Console_Process_Unix%2C-Process-instance-does-not-set-isRunning-state-on-termination-tp23771999p23771999.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to