mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Avoiding duplicate compileJoins on directory deletion
This commit is contained in:
@@ -193,6 +193,7 @@
|
||||
compileTimeout = null;
|
||||
watchErr = function(e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
if (sources.indexOf(source === -1)) return;
|
||||
removeSource(source, base, true);
|
||||
return compileJoin();
|
||||
} else {
|
||||
@@ -237,24 +238,7 @@
|
||||
};
|
||||
|
||||
watchDir = function(source, base) {
|
||||
var watchErr, watcher;
|
||||
watchErr = function(e) {
|
||||
var file, toRemove, _i, _len;
|
||||
toRemove = (function() {
|
||||
var _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = sources.length; _i < _len; _i++) {
|
||||
file = sources[_i];
|
||||
if (file.indexOf(source) >= 0) _results.push(file);
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
for (_i = 0, _len = toRemove.length; _i < _len; _i++) {
|
||||
file = toRemove[_i];
|
||||
removeSource(file, base, true);
|
||||
}
|
||||
return compileJoin();
|
||||
};
|
||||
var watcher;
|
||||
try {
|
||||
return watcher = fs.watch(source, function() {
|
||||
return fs.readdir(source, function(err, files) {
|
||||
|
||||
@@ -172,6 +172,7 @@ watch = (source, base) ->
|
||||
|
||||
watchErr = (e) ->
|
||||
if e.code is 'ENOENT'
|
||||
return if sources.indexOf source is -1
|
||||
removeSource source, base, yes
|
||||
compileJoin()
|
||||
else throw e
|
||||
@@ -206,11 +207,6 @@ watch = (source, base) ->
|
||||
|
||||
# Watch a directory of files for new additions.
|
||||
watchDir = (source, base) ->
|
||||
watchErr = (e) ->
|
||||
toRemove = (file for file in sources when file.indexOf(source) >= 0)
|
||||
removeSource file, base, yes for file in toRemove
|
||||
compileJoin()
|
||||
|
||||
try
|
||||
watcher = fs.watch source, ->
|
||||
fs.readdir source, (err, files) ->
|
||||
|
||||
Reference in New Issue
Block a user