On Fri, Mar 16, 2012 at 8:53 AM, Dan North <[email protected]> wrote:
> When you watch a file you're actually watching an inode (a magic number > that represents the file). If that file gets deleted and another one with > the same name gets created, it's not the same file (it will have a > different inode). Likewise if you replace a file with mv(1). > > This is the difference between tail -f and tail -F for example: the latter > watches to see if the file is replaced by another. If gedit is saving the > current buffer into a temporary file then moving it over the new one (a > common approach because moving a file is atomic) you will no longer see > watch events on the new file. > > You can add another watch to the directory containing the file, then > you'll see the create, remove, rename, etc. events in that and you should > be able to spot what's going on and create a new watch for the new file > (and close the old one of course). > > Hi Dan. You're right. Watchign teh directory allows me to see all of the machinations of gedit, like this sequence from a single "Save" action: event is: rename filename provided: .goutputstream-QDILBW event is: change filename provided: .goutputstream-QDILBW event is: change filename provided: .goutputstream-QDILBW event is: rename filename provided: test.txt~ event is: rename filename provided: test.txt~ event is: rename filename provided: .goutputstream-QDILBW event is: rename filename provided: test.txt and I can do that all day and my node.js watcher script never gets tired. Of course we know that copies and deletes are both flagged as rename events. So I guess we see why it is safer to watch the enclosing directory and then ask questions about the files. I'm still not completely comfortable, but I think I can stay safe. Thanks! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
