note 82889 added to function.proc-open

From: Date: Wed, 30 Apr 2008 15:24:44 +0000
Subject: note 82889 added to function.proc-open
Groups: php.notes 
Request: Send a blank email to php-notes+get-138939@lists.php.net to get a copy of this message
I'm confused by the direction of the pipes. Most of the examples in this documentation opens pipe #2 as "r", because they want to read from stderr. That sounds logical to me, and that's what I tried to do. That didn't work, though. When I changed it to w, as in <?php $descriptorspec = array( 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("pipe", "w") // stderr ); $process = proc_open(escapeshellarg($scriptFile), $descriptorspec, $pipes, $this->wd); ... while (!feof($pipes[1])) { foreach($pipes as $key =>$pipe) { $line = fread($pipe, 128); if($line) { print($line); $this->log($line); } } sleep(0.5); } ... ?> everything works fine. ---- Server IP: 212.63.193.10 Probable Submitter: 194.47.157.221 ---- Manual Page -- http://www.php.net/manual/en/function.proc-open.php Edit -- https://master.php.net/note/edit/82889 Del: integrated -- https://master.php.net/note/delete/82889/integrated Del: useless -- https://master.php.net/note/delete/82889/useless Del: bad code -- https://master.php.net/note/delete/82889/bad+code Del: spam -- https://master.php.net/note/delete/82889/spam Del: non-english -- https://master.php.net/note/delete/82889/non-english Del: in docs -- https://master.php.net/note/delete/82889/in+docs Del: other reasons-- https://master.php.net/note/delete/82889 Reject -- https://master.php.net/note/reject/82889 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138939) next »