Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to give non-zero exit code in precense of file system errors #1638

Open
VRehnberg opened this issue Nov 13, 2024 · 1 comment
Open

Comments

@VRehnberg
Copy link

VRehnberg commented Nov 13, 2024

I'd like to use fd for checking for presence of stale file handles. Currently I can do:

fd . /path/to/nfs/mount/ --show-errors -X true 2> /dev/stdout | grep -qv "Stale file handle"

to get a command with a non-zero exit code in presence of such file system errors. However, having to output all the paths makes this much slower than running quietly.

Ideally one or more of the following alternatives should work.

1 Output errors even when rest is silenced --show-errors -q

fd . /path/to/nfs/mount/ --show-errors -q | grep -qv "Stale file handle"

2 When there are file system errors output a non-zero exit code

fd . /path/to/nfs/mount/ -q

3 Option to give non-zero exit code in presence of file system errors

fd . /path/to/nfs/mount/ --raise-error -q

would either exit with non-zero exit code on first file system error or after everything if there was any file system error.

@VRehnberg
Copy link
Author

Ah, probably misunderstood what -q does. Probably exits on first match and that's why it is so much faster.

Would still be nice with some possibility to just check for file system errors without dealing with lots of output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant