Hi!

I have a problem!

stream_select() is always returning *all* the streams.
I only want it to tell me which streams have data
waiting on them, or even better, which streams are
'finished' and have an EOF at the end of them (I
wish??  Is this possible??).  I think it is because
the STDOUT pipe/stream is blocking, and it refuses to
change to nonblocking when asked (If I add 'or die()'
after stream_set_blocking it dies).

Am I doing something wrong?  The below example should
just output "QUICK PROCESS" and finish, because the
'slow process' has not even started to output data to
the stream.  When I run it it outputs "SLOW PROCESS"
then "QUICK PROCESS".

I am using PHP5B4 and have also tried PHP5RC2-CVS, on
Windows 2000.

Warm regards,

jase303.



<?php
        $descriptorspec = array(1 => array("pipe", "w"));
        
        $fast_response  = proc_open('c:\web\php5\php.exe -r
"sleep(0); echo \'QUICK PROCESS \';"',
$descriptorspec, $pipes_fast) or die ("Couldn't open
proc"); 
        $slow_response  = proc_open('c:\web\php5\php.exe -r
"sleep(5); echo \'SLOW PROCESS \';"', $descriptorspec,
$pipes_slow) or die ("Couldn't open proc"); 
        
        stream_set_blocking($pipes_fast[1], FALSE);
        stream_set_blocking($pipes_slow[1], FALSE);
        
        print_r(stream_get_meta_data($pipes_fast[1]));
        print_r(stream_get_meta_data($pipes_slow[1]));
        
        $ready_for_reading = array($pipes_slow[1],
$pipes_fast[1]);
        $number_ready = stream_select($ready_for_reading, $a
= NULL, $b = NULL, 0, 0); // I would like this to
return only the proc that has done something!
        foreach ($ready_for_reading as $stream) {
                echo fread($stream, 4096);
        }
?>      




__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

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

Reply via email to