[PHP] Re: About resource of popen

2007-05-02 Thread Fernando chucre

Somebody? help me!!

:D

2007/4/30, Fernando chucre [EMAIL PROTECTED]:


Hello all,

I make a script for read and interprete the stdout of cmd `ip monitor`.
And I use signal_handler, the script is like this:
?
declare(ticks = 1);
pcntl_signal(SIGHUP,sig_handler,false);


$fh = popen('ip monitor','r');

while (!feof($fh))
{
$line = fgets($fh);
analize($line);
}

function analize($line) {  ...  } ;
function sig_handler($signo) { ... };
?

this script run in infine loop, or when to cmd 'ip monitor' exist. The
script ever whait the next line of 'ip monitor', ever. Then when I send the
signal SIGHUP to pid of script. In this point the instruction '$line =
fgets($fh);' is aborted and return false to $line. The $fh is modified and
the function feof($fh) return true and I have not access to $fh agaim. But
the kid process 'ip monitor' is not kill.

This is wanted?

--
Fernando Chure
PSL/CE





--
Fernando Chure
PSL/CE


Re: [PHP] Re: About resource of popen

2007-05-02 Thread Richard Lynch
What's in sig_handler function body, as it relates to $fh and/or
exiting the script?...

I probably won't know the answer, but I'm pretty sure nobody else will
either without that info.

On Wed, May 2, 2007 9:43 am, Fernando chucre wrote:
 Somebody? help me!!

 :D

 2007/4/30, Fernando chucre [EMAIL PROTECTED]:

 Hello all,

 I make a script for read and interprete the stdout of cmd `ip
 monitor`.
 And I use signal_handler, the script is like this:
 ?
 declare(ticks = 1);
 pcntl_signal(SIGHUP,sig_handler,false);


 $fh = popen('ip monitor','r');

 while (!feof($fh))
 {
 $line = fgets($fh);
 analize($line);
 }

 function analize($line) {  ...  } ;
 function sig_handler($signo) { ... };
 ?

 this script run in infine loop, or when to cmd 'ip monitor' exist.
 The
 script ever whait the next line of 'ip monitor', ever. Then when I
 send the
 signal SIGHUP to pid of script. In this point the instruction '$line
 =
 fgets($fh);' is aborted and return false to $line. The $fh is
 modified and
 the function feof($fh) return true and I have not access to $fh
 agaim. But
 the kid process 'ip monitor' is not kill.

 This is wanted?

 --
 Fernando Chure
 PSL/CE




 --
 Fernando Chure
 PSL/CE



-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php