bat attempts to execute itself when PAGER="bat"

Created on 27 Oct 2018  Â·  4Comments  Â·  Source: sharkdp/bat

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
feature-request good first issue question

All 4 comments

Nice find :smile:. 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").

Cool. I’ll be happy to try fixing this later this week if no one beats me to it :-)
On 27 Oct 2018, 14:32 +0200, David Peter notifications@github.com, wrote:

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").
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Closed via #393 by @rodorgas and 7cac07d84559dc6eb02b643f7f640d81a7a4c07e

Fixed in bat 0.9.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yum-feng picture yum-feng  Â·  3Comments

rien333 picture rien333  Â·  3Comments

gwpl picture gwpl  Â·  3Comments

gAmUssA picture gAmUssA  Â·  3Comments

tbsvttr picture tbsvttr  Â·  3Comments