{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"open","user":{"avatar_url":"https://secure.gravatar.com/avatar/80fc29197bcd704843bd600db4c50c21?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"80fc29197bcd704843bd600db4c50c21","url":"https://api.github.com/users/wvl","login":"wvl","id":387},"milestone":null,"assignee":{"avatar_url":"https://secure.gravatar.com/avatar/3d43d9038ab645ecb2e3a1df2951d30a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"3d43d9038ab645ecb2e3a1df2951d30a","url":"https://api.github.com/users/bnoordhuis","login":"bnoordhuis","id":275871},"labels":[],"updated_at":"2011-11-01T21:33:12Z","closed_at":null,"comments":1,"url":"https://api.github.com/repos/joyent/node/issues/1986","body":"On osx (10.7), I'm not seeing the file events being reported from fs.watch when:\r\n\r\n* using fs.writeFile to update a file (create works, as does a save from my editor)\r\n* touch\r\n* echo\r\n\r\n\r\nfswatch.js: test case\r\n\r\n```javascript\r\n\r\nvar fs = require('fs');\r\nvar D = require('util').debug;\r\n\r\nfs.watch('tmp', function(event, filename) {\r\n  D(\"fs.watch event: \"+event);\r\n});\r\n\r\nfunction write() {\r\n  D(\"Writing\");\r\n  fs.writeFile(\"tmp/hello.txt\", \"Hello\", function(err) {\r\n    D(\"Wrote file tmp/hello.txt\");\r\n  });\r\n}\r\n\r\nsetTimeout(write, 1000);\r\nsetTimeout(write, 2000);\r\n```\r\n\r\nOn linux (ubuntu 11.10), node 0.5.10\r\n\r\n```text\r\n$ mkdir tmp\r\n$ node fswatch.js &\r\n[1] 4622\r\n$ DEBUG: Writing\r\nDEBUG: fs.watch event: rename\r\nDEBUG: fs.watch event: change\r\nDEBUG: Wrote file tmp/hello.txt\r\nDEBUG: Writing\r\nDEBUG: fs.watch event: change\r\nDEBUG: fs.watch event: change\r\nDEBUG: Wrote file tmp/hello.txt\r\n\r\n$ touch tmp/hello.txt \r\nDEBUG: fs.watch event: change\r\n$ echo \"world\" >> tmp/hello.txt \r\n$ DEBUG: fs.watch event: change\r\n```\r\n\r\nOn osx (10.7), node 0.5.10\r\n\r\n```text\r\n > mkdir tmp\r\n > node fswatch.js &\r\n[1] 75764\r\n > DEBUG: Writing\r\nDEBUG: fs.watch event: rename\r\nDEBUG: Wrote file tmp/hello.txt\r\nDEBUG: Writing\r\nDEBUG: Wrote file tmp/hello.txt\r\n\r\n > touch tmp/hello.txt \r\n > echo \"hello\" >> test.txt \r\n > exit\r\n```","html_url":"https://github.com/joyent/node/issues/1986","number":1986,"title":"fs.watch not reporting events on osx","id":2113968,"created_at":"2011-11-01T19:17:39Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/3d43d9038ab645ecb2e3a1df2951d30a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"3d43d9038ab645ecb2e3a1df2951d30a","url":"https://api.github.com/users/bnoordhuis","login":"bnoordhuis","id":275871},"updated_at":"2011-11-01T21:33:12Z","url":"https://api.github.com/repos/joyent/node/issues/comments/2596314","body":"`touch` not being reported is a known flaw: kqueue, the mechanism backing `fs.watch()` on Darwin and the BSDs, doesn't report mtime updates. Appending to the file should generate events though. Will investigate.","id":2596314,"created_at":"2011-11-01T21:33:12Z"}}