How does/should rg handle broken symlink when the --follow option is activated? #2976
-
Hi all! Ripgrep is so useful! Thanks for it! One thing is not clear to : is As far as I know it behaves like this, when some symlinks are broken:
Should it terminate with a non-zero exit code even if it did find some matches?
So AFAIK we can't use the exit code to determine if there were any finding. I looked at the man page and can't find a clear description of the behaviour to expect. I might have missed it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 This behavior comes from GNU grep.
I feel like the
|
Beta Was this translation helpful? Give feedback.
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 a0
or1
exit code regardless of file system error.This behavior comes from GNU grep.