Skip to content
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

bat attempts to execute itself when PAGER="bat" #383

Closed
iravid opened this issue Oct 27, 2018 · 4 comments
Closed

bat attempts to execute itself when PAGER="bat" #383

iravid opened this issue Oct 27, 2018 · 4 comments
Labels
feature-request New feature or request good first issue Good for newcomers question Further information is requested
Milestone

Comments

@iravid
Copy link

iravid commented Oct 27, 2018

I like having other applications use bat as a pager, so I export PAGER="bat" in my .zshrc. However, bat will also use that env var and try to execute itself (recursively, endlessly).

To replicate:

export PAGER="bat"
# This hangs
ls | bat

# In another shell:
ps -fe | grep bat | wc -l
# 177 on my system

unset PAGER
# Works correctly
ls | bat
@sharkdp sharkdp added feature-request New feature or request good first issue Good for newcomers question Further information is requested labels Oct 27, 2018
@sharkdp
Copy link
Owner

sharkdp commented Oct 27, 2018

Nice find 😄. Thank you for reporting this.

You can easily work around this by setting PAGER="bat", but using BAT_PAGER to override this. For example, you can set BAT_PAGER="less". Starting with the next version of bat (or current master), you can also set --pager="less" in bats config file.

I think we should try to fix this by treating PAGER="bat" as if PAGER had not been set (and similarly for BAT_PAGER="bat" or --pager="bat").

@iravid
Copy link
Author

iravid commented Oct 27, 2018 via email

rodorgas added a commit to rodorgas/bat that referenced this issue Oct 31, 2018
@sharkdp sharkdp added this to the 0.9.0 milestone Nov 1, 2018
sharkdp pushed a commit that referenced this issue Nov 6, 2018
@sharkdp
Copy link
Owner

sharkdp commented Nov 6, 2018

Closed via #393 by @rodorgas and 7cac07d

@sharkdp sharkdp closed this as completed Nov 6, 2018
@sharkdp
Copy link
Owner

sharkdp commented Nov 11, 2018

Fixed in bat 0.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants