Hi, I mentioned this a week or so ago, but had no response. I have in mind a function that can work something like this:
$options = array( 0 => array("pipe", "r") // Stdin for new proc will be a pipe 1 => array("pipe", "w") // Stdout for new proc will be a pipe 2 => null, // Stderr will be /dev/null 3 => array("/path/to/other/file", "w") // fd 3 will be set to that of the // file handle ); The "w" or "r" are the modes with respect to the newly created process, so stdin would be readable, stdout and fd #3 writeable by the new process. $handles = proc_open($command_line, $options); Where $handles is an array of file handles that can be used to talk to the new process: $handles = array( 0 => $fpstdin, // PHP can write to this to send to process 1 => $fpstdout, // PHP can read from this to get process output ); This allows much greater control over the input/output of the process, and allows more security/flexibility when using something like gpg and passing passphrases to, or reading status messages from alternate fd's. I'm going to try and hack something together with this weekend; if anyone has comments or suggestions, please drop me a line. --Wez. On 29/03/02, [EMAIL PROTECTED] wrote: > Hello- > > I am wondering if there are any solutions for creating a bi- > directional process pipe. Currently, popen() is only uni-directional, > which isn't satisfactory for what I'm trying to do. Are there any > modules/libraries with a bi-directional pipe? Any ideas on how to > accomplish this? > Thank you. > > Kris > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php