Skip to content

How does/should rg handle broken symlink when the --follow option is activated? #2976

Answered by BurntSushi
pierre-rouleau asked this question in Q&A
Discussion options

You must be logged in to vote

So AFAIK we can't use the exit code to determine if there were any finding.

That is exactly correct and the intended outcome. The point is that an error occurring might result in missing a possible match you otherwise expected to find. If you don't want broken symlinks to impact the exit code, then you should filter them out before feeding it to ripgrep. Maybe via some find incantation (which I don't know off the top of my head). Or, if you just care about the presence of a match or not, you can use -q/--quiet to get a 0 or 1 exit code regardless of file system error.

This behavior comes from GNU grep.

I looked at the man page and can't find a clear description of the behaviour to expect.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pierre-rouleau
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants