Matthias Tacke" said:
Fair enough, this time I'll oblige.
LOL, that is a "silly"-conclusion ;-). Yes steadily outputs y crlf.
Yes I know what 'yes' does. It was you who didn't ;o)
Due to the fact that a second command processor receives this stream,
nothing will show up until the stream is terminated from outside.
It was a silly conclusion, mainly because I didn't experiment a bit more. On
winxp (at home now!), when you enter 'dir /s c:\ | head -10' it works
exactly as expected, 'type largefile | head -10' works as expected - except
for the extra line: 'The process tried to write to a nonexistent pipe.'
Presumably this means that head finished before the type command which
checked to see if it was writing to a pipe. Perhaps the DIR command checked
also but didn't think it worth mentioning a non-existing pipe.
If I have a file 'a.bat' with:
@echo off
echo a
echo a'
....
echo a
Then try 'a | head -5' (on winxp), I get:-
a
a
a
a
a
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
The process tried to write to a nonexistent pipe.
I know *nix pipes are somewhat different from windows ones but I dont know
the details. Seems to me that to make the 'yes' command to work like it does
on linux, 'yes' needs some pipe checking logic? Or is this silly?
Do all windows commands have pipe checking code?