|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-04-07 12:31 UTC] RQuadling at GMail dot com
Description:
------------
I'm trying to set non-blocking mode on pipes attached to a process
opened using proc_open.
The documentation and the user notes suggest that what I am doing
should work.
Running this with php -n to remove my ini file settings.
Reproduce code:
---------------
<?php
echo PHP_VERSION, ' ', PHP_OS, ' ', PHP_SAPI, PHP_EOL;
echo 'INI:', php_ini_loaded_file(), PHP_EOL;
// Define the descriptors.
$a_Descriptors = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
// Provide a place for the pipes.
$a_Pipes = array();
// Create the thread.
$r_Thread = proc_open("dir c:\\ /b", $a_Descriptors, $a_Pipes, Null, $_ENV);
// Display the current STDOUT meta data.
print_r(stream_get_meta_data($a_Pipes[1]));
// Try to change the blocking mode to non-blocking.
echo (stream_set_blocking($a_Pipes[1], False) ? 'Successfully' : 'Failed'), ' to set blocking mode to non-blocking', PHP_EOL;
// Display the current STDOUT meta data.
print_r(stream_get_meta_data($a_Pipes[1]));
Expected result:
----------------
5.3.0RC2-dev WINNT cli
INI:
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] => 1
[eof] =>
)
Successfully set blocking mode to non-blocking
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] =>
[eof] =>
)
Actual result:
--------------
5.3.0RC2-dev WINNT cli
INI:
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] => 1
[eof] =>
)
Failed to set blocking mode to non-blocking
Array
(
[stream_type] => STDIO
[mode] => r
[unread_bytes] => 0
[seekable] =>
[timed_out] =>
[blocked] => 1
[eof] =>
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
I also tried opening the pipes descriptors like ... $a_Descriptors = array(0 => array('pipe', 'rn'), 1 => array('pipe', 'wn'), 2 => array('pipe', 'wn')); but no change.