args: Do not attempt to build glob options when not specified. #1400
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.
Closes #1291
This is a first shot at addressing #1291, though I think some additional input is needed.
After reviewing and manually testing, I found that the source of the errors being raised was due to unconditionally building an
OverrideBuilder
from the globbing options. As this relies on the current working directory, it understandably fails when the cwd does not exist.The immediate error can be suppressed by checking that the globbing options are actually required before attempting to handle them. This will still raise the same error when any of these options are present without an existing cwd, though perhaps a clearer error message could also be emitted as part of this change in that case.
On the testing front, I wasn't able to suitably recreate the original issue in a regression test. In my experiments, I tried to set the
current_dir
of theTestCommand
to something non-existent before running, but this seemed to result in a panic before actually entering any ripgrep code when we go to execute the command.Manual testing showed that we were able to execute non-globbing ripgrep commands without failure from a non-existent cwd with this change applied.