bat: Failure to use less from BusyBox
Describe the bug you encountered: Step to reproduce:
- scoop install busybox, bat
- bat .\yourfile.
Here is the result in my machine:

What did you expect to happen instead?
No error
How did you install bat?
scoop install bat
bat version and environment
version: bat 0.20.0 (0655ecf) OS: Window 11 lastest
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (6 by maintainers)
Iβd like to take this one on since nobody else has claimed it.
Nice investigation π your approach sounds reasonable to me!
I personally would say not to bother checking older versions of busybox. And if a new version will be released which improves
less, we can updatebatto look at busybox versions then.Iβd vote for letting the grid lines stay as they are, but thatβs just my personal opinion.
So looking at busybox less as it gets built with the default config, thereβs no color support, but it can handle batβs other formatting decorations (in somewhat reduced capacity). Example:
So in less.rs the
parse_less_versionreturns anOption<usize>due to lessβs unconventional versioning, but busybox is on semantic versioning, so that return type gets messy if we try to account for busybox. It seems like weβre only doing that from output.rs (based on a quickgrep -Rin the source tree), so hereβs my initial thinking.If that sounds reasonable I can get something put together pretty quickly. I see a couple of tests that might affect, too, so I can take a look at those at the same time.
Questions
@nfisher1226 sounds great, thanks. Please let us know if you need any pointers π
Actually, we already do quite extensive version checks on less when bat starts. Perhaps we could try to catch this case too and stop passing invalid args. I suggest we re-open this. Might also be suitable for a new contributor to take a look at. Iβll change the title since this does not appear to be a Windows-specific bug.
Try with
--paging=neveror settingBAT_PAGERto override the command line args passed toless- it looks likely that busybox includes some dodgy version ofless