-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No "waiting for data" message when using F command on a pipe #555
Comments
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. |
On a file, poll() returns POLLIN (readable data) even if we are at end of file. This allows the code in ch_get to see that there is no data available and display the "waiting for data" message. But on a fifo, if there is no data available, poll() will block until the timeout, so at eof on a pipe we will be stuck in the poll and never display the waiting message. This commit changes the timeout so that on the first read on a fifo (when there is no waiting message displayed) we will use timeout=0 and return immediately. This allows ch_get to display the waiting message. After the message is displayed, subsequent reads will use an infinite timeout. Related to #555.
Resolved in 31cd391. |
Steps to reproduce:
i=0; while :; do echo $i; let i=$i+1; sleep .2; done > file &
.less file
.F
.i=0; while :; do echo $i; let i=$i+1; sleep .2; done | less
.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.
The text was updated successfully, but these errors were encountered: