About resource of popen

From: Date: Mon, 30 Apr 2007 16:56:46 +0000
Subject: About resource of popen
Groups: php.general 
Request: Send a blank email to php-general+get-254145@lists.php.net to get a copy of this message
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

« previous php.general (#254145) next »