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

fix: Ensure walk() doesn't error out on directory ENOENT #135

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Conversation

nzakas
Copy link
Contributor

@nzakas nzakas commented Oct 18, 2024

What is the purpose of this pull request?

Ensures that walk() doesn't error out on ENOENT errors. Due to the asynchronous nature of listing directory entries, it's possible that a directory may have been deleted before list() is called on it.

Other packages that do this:

Refs eslint/eslint#18955

What changes did you make? (Give an overview)

This pull request includes changes to handle directory listing errors more gracefully in the Hfs class and adds corresponding tests to ensure the new behavior is correct. The most important changes include modifying the walk method to handle ENOENT errors, updating the test suite to include a test for this new behavior, and importing necessary error classes.

Error handling improvements:

  • packages/core/src/hfs.js: Modified the walk method to catch ENOENT errors and return an empty array instead of throwing an error.

Test suite updates:

@nzakas nzakas merged commit 05873f8 into main Oct 18, 2024
0 of 3 checks passed
@nzakas nzakas deleted the enonent-walk branch October 18, 2024 21:17
@github-actions github-actions bot mentioned this pull request Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant