Use native command lookup for pagers - #3986
Open
Matei02355 wants to merge 2 commits into
Open
Conversation
Matei02355
marked this pull request as ready for review
September 7, 2026 16:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rust 1.58 removed implicit working-directory searches when launching Windows programs. The project's existing rust-version = 1.88 already enforces a sufficiently recent compiler, so retire the grep-cli executable-resolution workaround and its dependency.
Construct pager and version-query commands with std::process::Command. Keep the existing stdout fallback when launching a pager fails. On Windows, native lookup appends .exe but does not try .com, so retry an extensionless program with .com only after NotFound; this preserves bare more/custom COM pager support. Explicit extensions and non-NotFound launch errors never trigger that retry. Native executable lookup now takes precedence, with COM programs as a fallback. Diagnostics also use native command lookup.
Fixes #2027.
Validation: 474 tests passed locally with all features; seven platform/manual tests were ignored. All-target/all-feature Clippy, formatting and the minimal regex-onig library build passed. New Windows CI tests exercise a malicious pager in the working directory, PATH lookup for EXE and COM programs, explicit relative/absolute paths containing spaces, explicit-extension failures, version queries through a batch path, and rejection of retries after other launch errors. Windows-specific tests require the Windows CI runners and have not been executed locally.
Rust behavior: https://blog.rust-lang.org/2022/01/13/Rust-1.58.0/