delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/12/19:38:41

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
MIME-Version: 1.0
Subject: RE: tail -f and pipes with bash shell
Date: Fri, 13 May 2005 01:38:28 +0200
Message-ID: <90459864DAD67D43BDD3D517DEFC2F7D05AF26@axon.Axentia.local>
From: "Peter Ekberg" <peda AT axentia DOT se>
To: "Lev Bishop" <lev DOT bishop AT gmail DOT com>, <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j4CNceX2027576

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019