I have a command which streams data from a server and writes lines to stdout
. There is a large number of records that I would like to pipe to less
, but I would like to prevent my tool from continuing to stream data until the user goes to the next page, otherwise the tool will continue to download enormous amounts of data while the user is not viewing it yet.
Does less
block the input process from writing to stdout until the user goes to the next page, or does less
attempt to buffer the entire input somewhere?
If it's the latter, is it possible to change the behavior to the former via less
flags, or some implementation details in my code, or do I need to implement my own pagination system?