diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 6274941a47..269c3b3e28 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -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: @@ -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 @@ -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 @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 96d9edbcbf..6f1d9848e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/output.rs b/src/output.rs index 0926f2bf9a..ae2ff83a6f 100644 --- a/src/output.rs +++ b/src/output.rs @@ -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'. @@ -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 {