Skip to content

Instantly share code, notes, and snippets.

@trentm
Created July 25, 2012 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trentm/3174841 to your computer and use it in GitHub Desktop.
Save trentm/3174841 to your computer and use it in GitHub Desktop.
[root@headnode (bh1-kvm7:0)]# cat foo.js
var fs = require('fs');
fs.watch("/var/tmp/follow.log", {persistent: true}, function (event, filename) {
console.log("EVENT", event, filename);
});
[root@headnode (bh1-kvm7:0)]# ./build/node/bin/node --version
v0.6.19
[root@headnode (bh1-kvm7:0)]# uname -a
SunOS headnode 5.11 joyent_20120723T091636Z i86pc i386 i86pc
[root@headnode (bh1-kvm7:0)]# ./build/node/bin/node foo.js > foo.log
# Then in another terminal I ran:
[root@headnode (bh1-kvm7:0) /var/tmp]# echo foo >> follow.log
# ... then I ^C'd the "foo.js" run as fast as I could and:
[root@headnode (bh1-kvm7:0)]# wc -l foo.log
41468 foo.log
[root@headnode (bh1-kvm7:0)]# cat foo.log |uniq
EVENT change null
IOW, `fs.watch` is in an infinite loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment