# Allow recovering from Walker.next errors without continually hitting the same error · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/af835111fa1397578392a4774454ac0d71eca77d)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: af835111fa1397578392a4774454ac0d71eca77d

Requested commit: af835111fa1397578392a4774454ac0d71eca77d

Commit: af835111fa1397578392a4774454ac0d71eca77d

Tree: b089216012a03836c96facdb94c26a52815ed2e0

Author: Ryan Liptak

Committer: Ryan Liptak

## Message

```
Allow recovering from Walker.next errors without continually hitting the same error

Before this commit, if Walker.next errored with e.g. `error.AccessDenied` and the caller did something like `while (true) { walker.next() catch continue; }`, then the directory that errored with AccessDenied would be continually iterated in each `next` call and error every time with AccessDenied.

After this commit, the directory that errored will be popped off the stack before the error is returned, meaning that in the subsequent `next` call, it won't be retried and the Walker will continue with whatever directories remain on its stack.

For a real example, before this commit, walking `/proc/` on my system would infinitely loop due to repeated AccessDenied errors on the same directory. After this commit, I am able to walk `/proc/` on my system fully (skipping over any directories that are unable to be iterated).

```

## Parents

- [7555085e6304419c25bb870567eb265bb22d0337](https://git.cafe/gitcafe/zig/commit/7555085e6304419c25bb870567eb265bb22d0337?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/af835111fa1397578392a4774454ac0d71eca77d?format=markdown)
