This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: tail -f and pipes with bash shell


Lev Bishop wrote:
> On 11/05/05, Peter Ekberg wrote:
>> What is going on here?
> 
> My guess: "tail frame.log" closes its stdout as soon as it has read
> the requested lines from the file, "tail -f frame.log" keeps its
> stdout open, since it is waiting for new lines to be added to the
> logfile. Cat is using some buffering on its stdin, so it tries to read
> a buffer's worth of data at a time.

Ah, thanks for the hint!

But, the buffering does not seem to happen in cat (or
is at least triggered by something external to cat).

If I open two cmd window consoles, and in the first
one I issue
~$ cat > foobar

And in the second one I issue
~$ tail -f foobar | grep d
I see all lines entered in the first console on the
second console (if they have d in them) with a fairly
rapid response time.

But if I instead issue this in the second console
~$ tail -f foobar | grep d | grep d
I get the buffering effect with high latencies...

Also, if I issue this in the second console
~$ tail -f foobar | cat
I again get a farily rapid response time.

So, the buffering does not seem to be related to cat,
but to where in the pipe the process is located, or
to the length of the pipe or something.

Rather unintuitive, my guess is that it's BYAM...

Cheers,
Peter

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]