ripgrep
ripgrep copied to clipboard
Force binary existance check
This PR allows for explicit checking for binary existence when using the associate
and try_associate
methods on the DecompressionMatcherBuilder
. I have tried to preserve the current resolve_binary
api being a no-op on non-windows as well.
Currently, a use tries to {try_}associate
a program on a non-windows OS, resolve_binary
no-ops and never checks the path to see if that binary actually exists or not.
This change forces a path check for existence even on non-windows OS so that a user can try to associate several different binaries with a glob and only the binaries found on the system will be associated.
Concrete example: https://github.com/sstadick/hck/blob/f5aca37b0a06523074fe229fa77bb863e4f8574c/src/lib/core.rs#L365
I want to associate pigz
with *.gz
only if pigz
is installed on the users system, otherwise it can fail and gzip
can be used. Currently pigz
is not actually tested for existence, it's added as a matcher and then fails to find it when called resulting in no decompression happening.