Skip to content

use correct exit code when called with double pipe (||) - #208

Merged
wofr06 merged 2 commits into
wofr06:lesspipefrom
g-v-egidy:double-pipe
Aug 22, 2026
Merged

use correct exit code when called with double pipe (||)#208
wofr06 merged 2 commits into
wofr06:lesspipefrom
g-v-egidy:double-pipe

Conversation

@g-v-egidy

Copy link
Copy Markdown
Contributor

less supports calling LESSOPEN with a double pipe since v447, like
LESSOPEN='||/usr/bin/lesspipe.sh %s'. When using it this way, less
can differentiate between a lesspipe that returns an actually empty
file and the case when lesspipe doesn't want to interfere and tells
less to directly open the file by using a non-zero returncode.
This allows for example to use the follow (+F) mode.

Before this patch lesspipe.sh already had partial support for the
double pipe call. This is done by detecting the double pipe call and
setting $retval.

But this mechanism wasn't used for .lessignore and when less was
called with "+F". This patch extends support for those codepaths too.

Apply this pull request after #207
to prevent conflicts.

less supports calling LESSOPEN with a double pipe since v447, like
LESSOPEN='||/usr/bin/lesspipe.sh %s'. When using it this way, less
can differentiate between a lesspipe that returns an actually empty
file and the case when lesspipe doesn't want to interfere and tells
less to directly open the file by using a non-zero returncode.
This allows for example to use the follow (+F) mode.

Before this patch lesspipe.sh already had partial support for the
double pipe call. This is done by detecting the double pipe call and
setting $retval.

But this mechanism wasn't used for .lessignore and when less was
called with "+F". This patch extends support for those codepaths too.
@wofr06
wofr06 merged commit 36ccbc7 into wofr06:lesspipe Aug 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants