Browse files

Avoid errors because of too many open files.

Fixes #8
  • Loading branch information...
1 parent 8c8fdfb commit 0c1a7928be6107fb6649028dbdba9c6506c2303b @magnars committed Mar 22, 2013
Showing with 13 additions and 2 deletions.
  1. +1 −0 lib/jslint-linter.js
  2. +10 −1 lib/lint-scanner.js
  3. +2 −1 todo.org
View
1 lib/jslint-linter.js
@@ -9,6 +9,7 @@ function check(file, fileName) {
}
function checkFile(promise, fileName, err, file) {
+ if (err) { return require("./print").red(err); }
var checked = check.call(this, file, fileName);
this.emit('fileChecked', checked);
promise.resolve(checked.errors);
View
11 lib/lint-scanner.js
@@ -68,9 +68,18 @@ function checkLint(file) {
return this.linter.checkFile(file);
}
+function checkNextFile(files, callback) {
+ if (files.length === 0) {
+ callback();
+ }
+ checkLint.call(this, files.pop()).then(function () {
+ checkNextFile.call(this, files, callback);
+ }.bind(this));
+}
+
function checkFiles(files) {
var d = when.defer();
- when.all(files.map(checkLint.bind(this))).then(function () {
+ checkNextFile.call(this, files, function () {
d.resolve();
});
return d.promise;
View
3 todo.org
@@ -1,4 +1,5 @@
-* Todo [3/9]
+* Todo [4/10]
+** DONE Avoid errors because of too many open files
** TODO Dont bundle jslint or jshint, but fetch them with npm
- requires some loading magic for jslint, since Crockford refuses
to make jslint node-friendly.

0 comments on commit 0c1a792

Please sign in to comment.