note 89546 deleted from function.stream-get-contents by danbrown
| From: | danbrown@php.net | Date: | Fri, 13 Mar 2009 02:18:24 +0000 |
| Subject: | note 89546 deleted from function.stream-get-contents by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151813@lists.php.net to get a copy of this message | ||
Note Submitter: Stefan P.
----
Actually, the correct way to handle the mentioned blocking read is this:
stream_set_blocking( $fromProc, 0 );
This switches the stream $fromProc to non-blocking mode. Thus, any call of stream_set_blocking
returns immediately - with or without a result.
To figure out, if your process still runs, retrieve the process state of the process descriptor
$procInfo = proc_get_status( $process );
and check, if it is still running
$isRunning = $procInfo[ 'running' ];
If the process is still running, but you didn't receive any output, you might wish to give the
process some time to perform it's task and make PHP sleep for some time
sleep( 1 );
and then try your read again.