-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
du: Return non zero error code when dealing with permissions errors #3382
Conversation
Nd make the tests/du/no-x.sh & long-sloop.sh pass
Fixes more stuff than expected:
But caused a regression:
I will have a look later |
OK, it isn't a regression. We had the issue before but we were not returning an error code. The error in long-from-unreadable.sh is
explained here even if we don't use walkdir, it is probably the same underlying issue: So, good for review! |
@@ -340,8 +341,12 @@ fn du( | |||
let description = format!("cannot access {}", entry.path().quote()); | |||
let error_message = "Permission denied"; | |||
show_error_custom_description!(description, "{}", error_message); | |||
set_exit_code(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be cleaned up some more with UResult
, which will print the right error message automatically when converting from an io::Error
. However, that is a more involved refactor, so I'll approve and leave it up to you whether you want to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will land this and open an new issue and maybe work on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Make the tests/du/no-x.sh & long-sloop.sh pass