Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Windows: fs.watch triggered twice on fs.writeFileSync #1970

Closed
peterwmwong opened this issue Oct 30, 2011 · 4 comments
Closed

Windows: fs.watch triggered twice on fs.writeFileSync #1970

peterwmwong opened this issue Oct 30, 2011 · 4 comments

Comments

@peterwmwong
Copy link

Test case and results between Win 7 and Ubuntu: https://gist.github.com/1326322

PS - Another difference is on FSWatcher.close()... It triggers the watch callback on Windows, but not on Ubuntu.

@bnoordhuis
Copy link
Member

@igorzi: The callback after close() seems like a bug in the Windows implementation.

@ghost ghost assigned igorzi Oct 31, 2011
@igorzi
Copy link

igorzi commented Oct 31, 2011

Yeah, this sounds like a bug in libuv. I'll investigate.

@byteshijinn
Copy link

It caused by windows itself. It is said that multiple notifications are expected. What you see as "one" modification is really numerous calls to the Win32 API. Since there is no transaction to bucket all of the calls together, the filesystem is forced to send out multiple notifications for various kernel calls.
So it's not a bug of libuv.

@igorzi
Copy link

igorzi commented Nov 3, 2011

Actually there are 2 issues here:

  1. 2 change callbacks are fired on a write to a file.
  2. change callback is fired after 'close'

As @bombworm mentioned, the 1st issue is by design on windows. The 2nd issue is a bug in libuv, which was fixed in joyent/libuv@0fb3769

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

No branches or pull requests

4 participants