note 89546 added to function.stream-get-contents

From: Date: Fri, 13 Mar 2009 00:54:48 +0000
Subject: note 89546 added to function.stream-get-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-151811@lists.php.net to get a copy of this message
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. ---- Server IP: 212.124.37.9 Probable Submitter: 95.118.166.59 ---- Manual Page -- http://www.php.net/manual/en/function.stream-get-contents.php Edit -- https://master.php.net/note/edit/89546 Del: integrated -- https://master.php.net/note/delete/89546/integrated Del: useless -- https://master.php.net/note/delete/89546/useless Del: bad code -- https://master.php.net/note/delete/89546/bad+code Del: spam -- https://master.php.net/note/delete/89546/spam Del: non-english -- https://master.php.net/note/delete/89546/non-english Del: in docs -- https://master.php.net/note/delete/89546/in+docs Del: other reasons-- https://master.php.net/note/delete/89546 Reject -- https://master.php.net/note/reject/89546 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151811) next »