I am using Kernel Queues in OS X to watch for file events (sample code) and when I run the sample code on a file foo.bar and then modify the file, the sample prints out that it recieved a delete event for the file. How could this be? Is this a bug?
I am using Kernel Queues in OS X to watch for file events (
Share
By “modifying” the file, I take it you mean editing it or whatever.
No, this is not a bug. Most text editors write the contents of a modified file in another file, then flush and close it, then delete the original and rename the other file to the original.
On the other hand, some “simple” edit operations, such as appending a line to a file using
echo whatever >>thefile, will not delete the file but open/seek/write/flush/close it.