|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-12-09 15:25 UTC] vmiszczak at ankama dot com
Description: ------------ I'm writing a data multiplexer PHP CLI script that takes data from STDIN and dispatchs those data on programs opened with proc_open(). I'm using stream_select() to see which descriptor has data. The read array I'm using contains STDIN and the output streams from programs opened with proc_open() (the classic $pipes[1] from proc_open() descriptorspec). Those programs write on their stdout as soon as there is data on their stdin (actually those programs are PHP scripts echoing input). If STDIN remains in the read set, stream_select returns only STDIN as readable and never returns any of the programs output streams. As soon as STDIN is removed from the read set, stream_select behave normaly and selects the output streams that are ready. Expected result: ---------------- I'm expecting all my ready streams to be returned, even if STDIN is present in the set. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
This is just a timing issue. For instance, when I call sleep() after calling "$this->startPingPongProgram();", I get: STDIN is blocking Program STDIN is blocking Program STDOUT is blocking Program STDERR is blocking We have 1 descriptor(s) ready : Array ( [0] => Resource id #1 ) We have 1 descriptor(s) ready : Array ( [0] => Resource id #1 ) We have 1 descriptor(s) ready : Array ( [0] => Resource id #1 ) We have 2 descriptor(s) ready : Array ( [0] => Resource id #5 [1] => Resource id #1 ) We got data on Resource id #5 : !!! line 1 !!! !!! line 2 !!! !!! line 3 !!! line is false Program's STDIN closed Program's STDOUT closed Program's STDERR closed Program terminated Which disproves your thesis. You'll have to coordinate the processes. Thanks for the report, but I'm marking it bogus.