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: handle long globs #16233

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix: handle long globs #16233

wants to merge 1 commit into from

Conversation

jsoref
Copy link

@jsoref jsoref commented Apr 26, 2024

Description

prettier wraps lstat to look for cases where a file does not exist... When it does not exist, it will try treating the argument as a glob.

For very long globs, the system will return ENAMETOOLONG instead of ENOENT. This is still a case where the file does not exist and where a glob could exist.

Instead of letting that error bubble up as an uncaught exception, swallow it in the same manner as ENOENT.

Fixes #16115.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

prettier wraps lstat to look for cases where a file does not exist...
When it does not exist, it will try treating the argument as a glob.

For very long globs, the system will return ENAMETOOLONG instead of ENOENT.
This is still a case where the file does not exist and where a glob could
exist.

Instead of letting that error bubble up as an uncaught exception,
swallow it in the same manner as ENOENT.
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.

ENAMETOOLONG error when running prettier
1 participant