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

Setting awaitWriteFinish to true triggers infinite change events #1224

Closed
Tracked by #1026
0x2b3bfa0 opened this issue Jun 8, 2022 · 0 comments
Closed
Tracked by #1026

Setting awaitWriteFinish to true triggers infinite change events #1224

0x2b3bfa0 opened this issue Jun 8, 2022 · 0 comments
Labels

Comments

@0x2b3bfa0
Copy link

0x2b3bfa0 commented Jun 8, 2022

Description

Setting awaitWriteFinish to true produces infinite change events when modifying the file access time from inside the event handler. Setting awaitWriteFinish to false doesn't.

Versions

  • Chokidar version: 3.5.3
  • Node version: 18.3.0
  • Ubuntu version: 20.04

Example

Directory structure

.
├── file
└── test.js

Contents of file

Empty (irrelevant)

Contents of test.js

require("chokidar")
  .watch("file", { awaitWriteFinish: true })
  .on("all", (event, path) => {
    require("fs").utimesSync("file", new Date(), new Date());
    console.log({ event, path });
  });

Expected behavior

Should behave exactly like when setting awaitWriteFinish to false and produce a single event, or produce infinite change events in both cases.

Additional context

This might be an XY Problem, where the “real issue” is utimes triggering a change event. 🤔

@0x2b3bfa0 0x2b3bfa0 changed the title Setting awaitWriteFinish to true triggers recursive change events Setting awaitWriteFinish to true triggers infinite change events Jun 8, 2022
@paulmillr paulmillr added the linux label Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants