Re: [INTERNALS-WIN] STDIN missing.
| From: | Richard Quadling | Date: | Tue, 25 Aug 2009 18:56:03 +0000 |
| Subject: | Re: [INTERNALS-WIN] STDIN missing. | ||
| References: | 1 2 | Groups: | php.internals.win |
| Request: | Send a blank email to internals-win+get-575@lists.php.net to get a copy of this message | ||
2009/8/25 Pierre Joye <pierre.php@gmail.com>:
> 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<rquadling@googlemail.com> 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