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

Delete event occurs after create event #17962

Closed
peter-ahe-google opened this issue Apr 2, 2014 · 3 comments
Closed

Delete event occurs after create event #17962

peter-ahe-google opened this issue Apr 2, 2014 · 3 comments
Labels
area-library library-io os-osx P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@peter-ahe-google
Copy link
Contributor

On Mac, I'm observing behavior where new Directory(...).watch() sends events in a weird order.

Basically, I see this when I revert a file in git:

{"modify":[".../cache.dart"]}
{"create":[".../cache.dart"]}
{"modify":[".../cache.dart"]}
{"delete":[".../cache.dart"]}

I think what happens is that two events occur when a file is overwritten, create a new inode, and delete the old inode.

@peter-ahe-google
Copy link
Contributor Author

Repro:

import 'dart:io';

main() {
  new Directory('.').watch().listen((FileSystemEvent event) {
    print(event);
  });
}

  1. Run the above program in a git repository.
  2. Modify a file which is tracked by git.
  3. Revert the file using "git checkout -- filename"

Result:

FileSystemModifyEvent('./LICENSE', contentChanged=true)
FileSystemCreateEvent('./LICENSE')
FileSystemModifyEvent('./LICENSE', contentChanged=true)
FileSystemDeleteEvent('./LICENSE')

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Library-IO label.

@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
@brianquinlan
Copy link
Contributor

This behavior is now documented.

It is hard to avoid this behavior on OS X without taking a large performance hit.

@brianquinlan brianquinlan added P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team labels Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-library library-io os-osx P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants