Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: | less +F buffering problem?

by liverpole (Monsignor)
on Aug 18, 2006 at 14:30 UTC ( [id://568165]=note: print w/replies, xml ) Need Help??

in reply to Re^2: | less +F buffering problem?
in thread | less +F buffering problem?

That's because, in the case of:
perl -e 'print "a line\n" x 10' | less +F
the end-of-file is encountered as soon as the program finishes, so the pipe gets the end-of-file, and less knows it has received all the input it's going to get.

Here's a good way to test it -- try executing the following command:

perl -e 'while (1) {print "a line\n" x 1000; sleep 1}' | less

Now the input buffer to less will fill up almost immediately, so you'll see the output right away.  However, if you execute the command "G", it will never find the end-of-file, because the end-of-file hasn't been written yet!

Similarly if you execute the same command with less +G at the end instead of less, you'll never see output for the same reason.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://568165]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-13 10:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found