Skip to content

crash on watcher ignore check #461

Open
@helpsl

Description

@helpsl

Describe the bug

Getting a crash when a file / folder change occurs but is deleted before executing validating the path

node:internal/event_target:1101 process.nextTick(() => { throw err; }); ^ Error: ENOENT: no such file or directory, stat 'D:\Projects\web\.vs\web\FileContentIndex\merges' at statSync (node:fs:1740:25) at file:///D:/Projects/web/node_modules/vite-plugin-checker/dist/glob.js:25:68 at matchPatterns (file:///D:/Projects/web/node_modules/vite-plugin-checker/node_modules/chokidar/esm/index.js:63:13)

Reproduction

trigger a file/folder validation check but delete that item before plugin finishes executing check

as it's dependant on execution time you might be able to add a break point in to your code to delay the check while you delete the file/folder in question

Expected behavior

path validation doesn't cause the plugin to crash when it fails to validate a non-existent path

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (12) x64 AMD Ryzen 5 7600 6-Core Processor
    Memory: 18.15 GB / 31.15 GB
Binaries:
    Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
Browsers: {}
npmPackages:
    vite-plugin-checker: ^0.9.0 => 0.9.0

Additional context

it looks as if using statSync in glob.js will cause a throw if the path which you are checking no longer exists at the time of verification.
adding throwIfNoEntry as a secondary parameter to the function and updating the isDirectory check call to only be called if the returned value is defined seems to fix the issue.

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions