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(readdir): 🐛 Error no such file or directory #352

Merged
merged 1 commit into from
Dec 19, 2019

Conversation

magarcia
Copy link
Contributor

  • readdir throws ENOENT: no such file or directory, when
    the directory does not exists one of the file systems.
  • Problem solved checking also if there are some results before a throw.

Fixes #351

@imsnif
Copy link

imsnif commented Dec 17, 2019

It would be really great to see this merged! :)

@imsnif
Copy link

imsnif commented Dec 17, 2019

As a workaround, we're doing:

fsToPatch.readdir = async function (...args) {
  try {
    const res = await fs.readdir(...args)
    return res
  } catch (e) {
    if (e.code === 'ENOENT') {
      return vfs.readdir(...args)
    } else {
      throw e
    }
  }
}
fsToPatch.readdirSync = function (...args) {
  try {
    return fs.readdirSync(...args)
  } catch (e) {
    if (e.code === 'ENOENT') {
      return vfs.readdirSync(...args)
    } else {
      throw e
    }
  }
}

Copy link
Owner

@streamich streamich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@streamich streamich merged commit d2161bb into streamich:master Dec 19, 2019
@imsnif
Copy link

imsnif commented Dec 19, 2019

@streamich - maybe if you're on a roll you can also merge #348 (same as this but for the sync version)?

Thanks! :)

@streamich
Copy link
Owner

🎉 This PR is included in version 4.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

readdir fails with error when one of the fs fails
3 participants