mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Ensuring that fs.watch duplication does not occur
This commit is contained in:
@@ -197,11 +197,12 @@
|
||||
|
||||
watch = function(source, base) {
|
||||
return fs.stat(source, function(err, prevStats) {
|
||||
var callback;
|
||||
var callback, watcher;
|
||||
if (err) throw err;
|
||||
return fs.watch(source, callback = function(event) {
|
||||
return watcher = fs.watch(source, callback = function(event) {
|
||||
if (event === 'rename') {
|
||||
return fs.watch(source, callback);
|
||||
watcher.close();
|
||||
return watcher = fs.watch(source, callback);
|
||||
} else if (event === 'change') {
|
||||
return fs.stat(source, function(err, stats) {
|
||||
if (err) throw err;
|
||||
|
||||
Reference in New Issue
Block a user