1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

"Re-fs.watching files on rename event"

See discussion at #1803, #1846, and at
https://github.com/joyent/node/issues/2062
This commit is contained in:
Trevor Burnham 2011-11-09 19:49:14 +01:00
parent 7aaaac42bc
commit 966063db0c
2 changed files with 10 additions and 5 deletions

View file

@ -197,9 +197,12 @@
watch = function(source, base) {
return fs.stat(source, function(err, prevStats) {
var callback;
if (err) throw err;
return fs.watch(source, function(event) {
if (event === 'change') {
return fs.watch(source, callback = function(event) {
if (event === 'rename') {
return fs.watch(source, callback);
} else if (event === 'change') {
return fs.stat(source, function(err, stats) {
if (err) throw err;
if (stats.size === prevStats.size && stats.mtime.getTime() === prevStats.mtime.getTime()) {