note 62663 added to function.proc-open
| From: | KevinBarr at osu1 dot php dot net | Date: | Mon, 06 Mar 2006 20:36:51 +0000 |
| Subject: | note 62663 added to function.proc-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104933@lists.php.net to get a copy of this message | ||
I found that with disabling stream blocking I was sometimes attempting to read a return line before
the external application had responded. So, instead, I left blocking alone and used this simple
function to add a timeout to the fgets function:
// fgetsPending( $in,$tv_sec ) - Get a pending line of data from stream $in, waiting a maximum of
$tv_sec seconds
function fgetsPending(&$in,$tv_sec=10) {
if ( stream_select($read = array($in),$write=NULL,$except=NULL,$tv_sec) ) return fgets($in);
else return FALSE;
}
----
Server IP: 66.163.161.117
Probable Submitter: 155.70.23.45 (proxied: unknown)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.proc-open.php
Edit -- http://master.php.net/note/edit/62663
Del: integrated -- http://master.php.net/note/delete/62663/integrated
Del: useless -- http://master.php.net/note/delete/62663/useless
Del: bad code -- http://master.php.net/note/delete/62663/bad+code
Del: spam -- http://master.php.net/note/delete/62663/spam
Del: non-english -- http://master.php.net/note/delete/62663/non-english
Del: in docs -- http://master.php.net/note/delete/62663/in+docs
Del: other reasons-- http://master.php.net/note/delete/62663
Reject -- http://master.php.net/note/reject/62663
Search -- http://master.php.net/manage/user-notes.php