#44908 [Com]: stream_select on pipes returned by proc_open returns streams that are not ready
| From: | ciocan at gmail dot com | Date: | Tue, 27 May 2008 15:51:01 +0000 |
| Subject: | #44908 [Com]: stream_select on pipes returned by proc_open returns streams that are not ready | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125305@lists.php.net to get a copy of this message | ||
ID: 44908
Comment by: ciocan at gmail dot com
Reported By: mike at silverorange dot com
Status: Open
Bug Type: Streams related
Operating System: Windows
PHP Version: 5.2.6
New Comment:
Sorry i forgot to mention that for me it happens in Linux: CentOS 5,
php 5.2.6 (and also tried on CentoOS 5, php 5.2.1)
Thank you,
Pavel
Previous Comments:
------------------------------------------------------------------------
[2008-05-27 15:46:52] pciocan at gmail dot com
I encountered the same problem with stream_select but when using named
pipes (created with posix_mkfifo and opened using fopen). Is there a
workaround for this problem?
Thank you,
Pavel
------------------------------------------------------------------------
[2008-05-04 23:31:35] mike at silverorange dot com
Jani,
I'm using the MSI install of PHP 5.2.6 (cli) (built Apr 30 2008
16:19:00) on Windows XP Home with Service Pack 2.
------------------------------------------------------------------------
[2008-05-04 21:50:20] jani@php.net
Please check the used PHP version. (phpinfo(); usually is the best way)
------------------------------------------------------------------------
[2008-05-04 08:08:55] mike at silverorange dot com
Edit:
Actual result:
--------------
The _write_ array contains stdin and the _read_ array contains stdout
and stderr. The stdout and stderr streams have no data ready and fread()
will block indefinitely.
------------------------------------------------------------------------
[2008-05-04 08:06:11] mike at silverorange dot com
Description:
------------
When using stream_select() on pipes returned by proc_open() in Windows,
input streams that are not ready are returned in the modified $read
array.
Reproduce code:
---------------
<?php
$pipes = array();
$proc = proc_open('c:/progra~1/gnu/gnupg/gpg.exe', array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')), $pipes, null, $_ENV);
if ($proc !== false) {
$write = array($pipes[0]);
$read = array($pipes[1], $pipes[2]);
$except = null;
$changed = stream_select($read, $write, $except, null);
if ($changed) {
print_r($read);
print_r($write);
}
proc_close($proc);
}
?>
Expected result:
----------------
The read array will be empty and the write array will contain stdin.
Actual result:
--------------
The read array contains stdin and the write array contains stdout and
stderr. The stdout and stderr streams have no data ready and fread()
will block indefinitely.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44908&edit=1