Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,21 @@ jobs:
fail-fast: false
matrix:
job:
- { target: aarch64-unknown-linux-musl , os: ubuntu-latest , dpkg_arch: arm64, use-cross: true }
- { target: aarch64-unknown-linux-gnu , os: ubuntu-latest , dpkg_arch: arm64, use-cross: true }
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-latest , dpkg_arch: armhf, use-cross: true }
- { target: arm-unknown-linux-musleabihf, os: ubuntu-latest , dpkg_arch: musl-linux-armhf, use-cross: true }
- { target: i686-pc-windows-msvc , os: windows-2025 , }
- { target: i686-unknown-linux-gnu , os: ubuntu-latest , dpkg_arch: i686, use-cross: true }
- { target: i686-unknown-linux-musl , os: ubuntu-latest , dpkg_arch: musl-linux-i686, use-cross: true }
- { target: x86_64-apple-darwin , os: macos-15-intel, }
- { target: aarch64-apple-darwin , os: macos-latest , }
- { target: x86_64-pc-windows-msvc , os: windows-2025 , }
- { target: aarch64-pc-windows-msvc , os: windows-11-arm, }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-latest , dpkg_arch: amd64, use-cross: true }
- { target: x86_64-unknown-linux-musl , os: ubuntu-latest , dpkg_arch: musl-linux-amd64, use-cross: true }
- { target: aarch64-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: arm64, use-cross: true }
- { target: aarch64-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: arm64, use-cross: true }
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-latest, dpkg_arch: armhf, use-cross: true }
- { target: arm-unknown-linux-musleabihf, os: ubuntu-latest, dpkg_arch: musl-linux-armhf, use-cross: true }
- { target: i686-pc-windows-msvc , os: windows-2025, }
- { target: i686-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: i686, use-cross: true }
- { target: i686-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: musl-linux-i686, use-cross: true }
- { target: x86_64-apple-darwin , os: macos-15-intel, }
- { target: aarch64-apple-darwin , os: macos-latest, }
- { target: x86_64-pc-windows-msvc , os: windows-2025, }
- { target: aarch64-pc-windows-msvc , os: windows-11-arm, }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: amd64, use-cross: true }
- { target: x86_64-unknown-linux-musl , os: ubuntu-latest, dpkg_arch: musl-linux-amd64, use-cross: true }
- { target: riscv64gc-unknown-linux-gnu , os: ubuntu-latest, dpkg_arch: riscv64, use-cross: true }
- { target: riscv64gc-unknown-linux-musl, os: ubuntu-latest, dpkg_arch: musl-linux-riscv64, use-cross: true }
env:
BUILD_CMD: cargo
steps:
Expand All @@ -186,6 +188,7 @@ jobs:
case ${{ matrix.job.target }} in
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
riscv64gc-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-riscv64-linux-gnu ;;
esac

- name: Install Rust toolchain
Expand All @@ -195,9 +198,7 @@ jobs:

- name: Install cross
if: matrix.job.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Overwrite build command env variable
if: matrix.job.use-cross
Expand Down Expand Up @@ -240,9 +241,9 @@ jobs:
id: test-options
shell: bash
run: |
# test only library unit tests and binary for arm-type targets
# test only library unit tests and binary for cross-compiled targets
unset CARGO_TEST_OPTIONS
unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${{ needs.crate_metadata.outputs.name }}" ;; esac;
unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-* | riscv64*) CARGO_TEST_OPTIONS="--lib --bin ${{ needs.crate_metadata.outputs.name }}" ;; esac;
echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT

- name: Run tests
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
- Improve native man pages and command help syntax highlighting by stripping overstriking, see #3517 (@akirk)

## Bugfixes
- Fix pager spawn detection under QEMU user-mode emulation. See #3531 (@OctopusET)
- `--help` now correctly honors `--pager=builtin`. See #3516 (@keith-hall)
- `--help` now correctly honors custom themes. See #3524 (@keith-hall)

## Other
- Use git version of cross. See #3533 (@OctopusET)
- Add CI support for RISC-V 64-bit. See #3532 (@OctopusET)

## Syntaxes

Expand Down
15 changes: 11 additions & 4 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ impl OutputType {
let args = pager.args;

if pager.kind == PagerKind::Less {
if retrieve_less_version(&pager.bin).is_none() {
return Ok(OutputType::stdout());
}

// less needs to be called with the '-R' option in order to properly interpret the
// ANSI color sequences printed by bat. If someone has set PAGER="less -F", we
// therefore need to overwrite the arguments and add '-R'.
Expand Down Expand Up @@ -166,10 +170,13 @@ impl OutputType {
p.args(args);
};

Ok(p.stdin(Stdio::piped())
.spawn()
.map(OutputType::Pager)
.unwrap_or_else(|_| OutputType::stdout()))
Ok(match p.stdin(Stdio::piped()).spawn() {
Ok(mut child) => match child.try_wait() {
Ok(Some(status)) if !status.success() => OutputType::stdout(),
_ => OutputType::Pager(child),
},
Err(_) => OutputType::stdout(),
})
}

pub(crate) fn stdout() -> Self {
Expand Down