Handle $PAGER being a command with args#6
Open
kba wants to merge 2 commits into
Open
Conversation
If `$PAGER` is set to a command with arguments (e.g. `less -Rs`), default-pager tried to execute the whole call as a binary. With this change, the `$PAGER` call will be split into command and arguments. It's still rather naive, won't handle arguments with escaped spaces or in quotes but it works for single-character arguments such as those used by `less`.
| if (pager.indexOf(' ') > 0) { | ||
| var pagerAndArgs = pager.split(/\s+/); | ||
| pager = pagerAndArgs[0] | ||
| opts.args = pagerAndArgs.slice(1) |
Collaborator
There was a problem hiding this comment.
Could you append opts.args to pager args, not replace them?
Collaborator
|
Thank you! I think it's worth it to keep it that simple for now. If there's ever a need for something more complex, we will add it later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If
$PAGERis set to a command with arguments (e.g.less -Rs),default-pager tried to execute the whole call as a binary. With this
change, the
$PAGERcall will be split into command and arguments.It's still rather naive, won't handle arguments with escaped spaces or
in quotes but it works for single-character arguments such as those used
by
less.