atom / watcher

Atom Filesystem Watcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Emit modification event for the creation of a non-empty file

smashwilson opened this issue · comments

Some platforms emit both a created and modified event for the creation of a non-empty file:

await fs.writeFile('file.txt', {}, 'contents\n')
{ action: "created", kind: "file", path: "/root/file.txt" }
{ action: "modified", kind: "file", path: "/root/file.txt" }

This is the technically correct behavior, because from the perspective of the filesystem, fs.writeFile performs two distinct operations: open("/root/file.txt") and write(fd, "contents\n").

  • Add a test case to ensure that this is happening consistently across platforms.
    • MacOS
    • Windows
    • Linux
  • Change watcher-stress to expect the immediate modification.