diff options
author | Wez Furlong <wez@php.net> | 2003-02-16 03:48:49 +0000 |
---|---|---|
committer | Wez Furlong <wez@php.net> | 2003-02-16 03:48:49 +0000 |
commit | 0a18a9d744afb9d97d46bad1f40c11a047bad5df (patch) | |
tree | 993ffad34c5dc4fb92e92b559e13cc95f2f32145 /run-tests.php | |
parent | 5edec2a91005a4c378c56801585c89029926c5b3 (diff) | |
download | php-git-0a18a9d744afb9d97d46bad1f40c11a047bad5df.tar.gz |
A add much more useful select(2) implementation than is provided by
windows sockets. The winsock implementation will only work with sockets;
our implementation works with sockets and file descriptors.
By association, stream_select() will now operate correctly with files, pipes and sockets.
This change required linking against the winsock2 library. In terms of
compatibility, only older versions of windows 95 do not have winsock2
installed by default. It is available as a redistributable file, and is most likely installed by any OS patches (eg: Internet Explorer) applied by the user.
Also, add a win32 compatible pipe test when opening a stream from a pipe. This test will only work on NT, win2k and XP platforms. Without this test, interleaved fread() and select() calls would cause the read buffer to be clobbered. I will be working on a fix for this issue for win9x.
Diffstat (limited to 'run-tests.php')
-rwxr-xr-x | run-tests.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/run-tests.php b/run-tests.php index cb68f32653..f393b5fedd 100755 --- a/run-tests.php +++ b/run-tests.php @@ -520,26 +520,32 @@ function system_with_timeout($commandline) { $data = ""; - $proc = proc_open($commandline, array(1 => array('pipe', 'w')), $pipes); + $proc = proc_open($commandline, array( + 0 => array('pipe', 'r'), + 1 => array('pipe', 'w'), + 2 => array('pipe', 'w') + ), $pipes); if (!$proc) return false; + fclose($pipes[0]); + while (true) { /* hide errors from interrupted syscalls */ $r = $pipes; $w = null; $e = null; - $n = stream_select($r, $w, $e, 60); + $n = @stream_select($r, $w, $e, 60); if ($n == 0) { /* timed out */ $data .= "\n ** ERROR: process timed out **\n"; proc_terminate($proc); return $data; - } else if ($n) { - $line = fgets($pipes[1]); - if ($line === false) { + } else if ($n > 0) { + $line = fread($pipes[1], 8192); + if (strlen($line) == 0) { /* EOF */ break; } |