gwsw / less

Less - text pager
http://greenwoodsoftware.com/less
Other
563 stars 88 forks source link

No "waiting for data" message when using F command on a pipe #555

Open gwsw opened 3 months ago

gwsw commented 3 months ago

Steps to reproduce:

  1. Run i=0; while :; do echo $i; let i=$i+1; sleep .2; done > file &.
  2. Run less file.
  3. Type F.
  4. Note that a "Waiting for data" message appears while content is scrolling.
  5. Exit less.
  6. Run i=0; while :; do echo $i; let i=$i+1; sleep .2; done | less.
  7. Type F.

Expected behavior: A "Waiting for data" message should appears as in the case of viewing a regular file.

Actual behavior: No "Waiting for data" message is visible.

gwsw commented 3 months ago

Actually the lack of the "waiting for data" message in this case is by design. See #337. The message can be made to appear by setting LESS_DATA_DELAY to a small number (less than 200 in this case). The inconsistency is arguably a problem in the case of viewing a file, in which it's reasonable to argue that the message should NOT appear, similar to the behavior for a pipe. The fact that the message does appear is due to the behavior of poll() which always returns POLLIN for a regular file, even if you are at EOF and no data is actually readable.