make stream_select return feof streams

Thankfully an easier change than I had hoped thanks to @sgolemon. This will hopefully let us run Symphony's `proc_open` wrappers.
Esse commit está contido em:
Paul Tarjan
2013-07-23 10:33:38 -07:00
commit de Sara Golemon
commit 42490349ef
3 arquivos alterados com 43 adições e 1 exclusões
+1 -1
Ver Arquivo
@@ -652,7 +652,7 @@ Variant f_socket_select(VRefParam read, VRefParam write, VRefParam except,
count = 0;
int nfds = 0;
if (!read.isNull()) {
sock_array_from_fd_set(read, fds, nfds, count, POLLIN|POLLERR);
sock_array_from_fd_set(read, fds, nfds, count, POLLIN|POLLERR|POLLHUP);
}
if (!write.isNull()) {
sock_array_from_fd_set(write, fds, nfds, count, POLLOUT|POLLERR);
+27
Ver Arquivo
@@ -0,0 +1,27 @@
<?php
$descriptors = array(
array('pipe', 'r'), // stdin
array('pipe', 'w'), // stdout
array('pipe', 'w'), // stderr
);
$process = proc_open('echo "hi"', $descriptors, $pipes);
// Hopefully echo is done in 1 second...
sleep(1);
for ($i = 0; $i < 2; $i++) {
$r = array($pipes[1], $pipes[2]);
$w = null;
$e = null;
var_dump(stream_select($r, $w, $e, 0, 200000));
foreach ($r as $pipe) {
var_dump(
array_search($pipe, $pipes),
fread($pipe, 8192),
feof($pipe)
);
}
}
@@ -0,0 +1,15 @@
int(2)
int(1)
string(3) "hi
"
bool(false)
int(2)
string(0) ""
bool(true)
int(2)
int(1)
string(0) ""
bool(true)
int(2)
string(0) ""
bool(true)