Rewatching on every file event, be it change or rename

This commit is contained in:
Trevor Burnham
2011-12-22 10:58:30 -08:00
parent d3f60599e8
commit 97cd7cc1c9
2 changed files with 15 additions and 22 deletions

View File

@@ -225,19 +225,15 @@
};
try {
return watcher = fs.watch(source, callback = function(event) {
if (event === 'change') {
return compile();
} else if (event === 'rename') {
watcher.close();
return wait(250, function() {
compile();
try {
return watcher = fs.watch(source, callback);
} catch (e) {
return watchErr(e);
}
});
}
return wait(250, function() {
compile();
try {
watcher.close();
return watcher = fs.watch(source, callback);
} catch (e) {
return watchErr(e);
}
});
});
} catch (e) {
return watchErr(e);

View File

@@ -196,16 +196,13 @@ watch = (source, base) ->
try
watcher = fs.watch source, callback = (event) ->
if event is 'change'
wait 250, ->
compile()
else if event is 'rename'
watcher.close()
wait 250, ->
compile()
try
watcher = fs.watch source, callback
catch e
watchErr e
try
watcher.close()
watcher = fs.watch source, callback
catch e
watchErr e
catch e
watchErr e