Re: [INTERNALS-WIN] STDIN missing.

[email protected] (Richard Quadling)
Newsgroups php.internals.win
Message-ID <[email protected]>
2009/8/25 Pierre Joye <[email protected]>:
> hi,
>
> Does it work for other scripting language?
>
> As it is not something php can control at this stage.
>
> Cheers,
>
> On Mon, Aug 24, 2009 at 1:44 PM, Richard
> Quadling<[email protected]> wrote:
>> Hi.
>>
>> Take the following simple PHP script.
>>
>> <?php
>> while(!feof(STDIN)) {
>>        $s = fgets(STDIN);
>>        if (!is_null($s)) {
>>                fputs(STDOUT, strrev($s));
>>        } else {
>>                echo "Waiting to get something from STDIN.\r";
>>        }
>> }
>> ?>
>>
>> Run this from the command line like ...
>>
>> DIR C:\ | C:\PHP5\php.exe C:\Scripts\Reverse.php
>>
>> and all is well - the output is reversed - can can be combined with
>> other filters ...
>>
>> DIR C:\*.txt | find /i ".txt" | C:\PHP5\php.exe C:\Scripts\Reverse.php | sort /r
>>
>> (OK, OTT, but actually works).
>>
>> Now, following the documentation in [1], I am allowed to use the
>> command thus ...
>>
>> DIR C:\ | C:\Scripts\Reverse
>>
>>
>> It loads (I can see it in Task Manager), but the STDIN isn't getting
>> to the PHP script and there is no output.
>>
>>
>>
>> OOI. If I just type ...
>>
>> C:\Scripts\Reverse
>>
>> STDIN is now waiting for me.
>>
>> So, if I enter ...
>>
>> Hello PHP-ers.[enter]
>>
>> I get output of ...
>>
>> .sre-PHP olleH
>>
>> As expected, so the script is talking to STDIN
>>
>>
>>
>>
>> Does anyone here know what is going on?
>>
>> Should PHP be getting the piped STDIN?
>>
>>
>> Regards,
>>
>> Richard.
>>
>>
>> [1] http://docs.php.net/manual/en/install.windows.commandline.php
>>
>> --
>> -----
>> Richard Quadling
>> "Standing on the shoulders of some very clever giants!"
>> EE : http://www.experts-exchange.com/M_248814.html
>> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
>> ZOPA : http://uk.zopa.com/member/RQuadling
>>
>> --
>> Windows Internals Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>
> --
> Pierre
>
> http://blog.thepimp.net | http://www.libgd.org
>

From what I've seen, I think this is another feature of windows.

I've only seen specific mention of this issue on Python lists, and
with the same answer, run the interpreter directly.

I wish I could talk to someone at MS, just to know what is going on.
But I'm a LONG way down the food chain for that.

Also, I don't know any other scripting languages well enough to
actually test them.

Richard.

-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.