note 19978 deleted from function.popen by didou
| From: | didou@php.net | Date: | Thu, 19 Feb 2004 17:29:36 +0000 |
| Subject: | note 19978 deleted from function.popen by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65410@lists.php.net to get a copy of this message | ||
Note Submitter: phpidoc@mrdrew.com
----
Unfortunately many of these posting are wrong. First, you cannot use 'r+' or
'w+' in popen as it is defined to accept only reading or writing (unidirectional.) There
does appear to be some kind of bug that returns the stdout into the page on pclose but this behavior
can not be counted on. If you want a bi-directional popen, go to the bug database and lookup
bug#9824. You can vote for a bi-directional popen there.
The post describing the two 'named' pipes approach is currently the only way I can
simulate the bi-popen(). THIS HAS A PROBLEM. Writers and Readers will BLOCK on pipes so you could
have many webprocess waiting on blocked pipes. Also, notice that there could be race conditions as
well since you can't gaurantee that the correct reader and writer get on the pipe at the same
time. One web process maybe reading the writings of the WRONG mate process.
I've tried every conceivable combo with popen, I even tried using popen in combo with only one
named pipe for output. This hung though due to blocking behavior. Maybe if you compile in pcntl
stuff you can get it to work, but that is not an option for me.
-Sorry about the length