Skip to content
Browse files

Ensure the application will not exit until all search paths have been…

… searched
  • Loading branch information...
1 parent 2c7463c commit 3d9dbdce9f64b9801c259e2524c105960c6075ee @lukebayes committed Oct 4, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/node_should/runner.js
View
7 src/node_should/runner.js
@@ -37,14 +37,19 @@ Runner.prototype.run = function(expr, paths, printers, completeHandler) {
this._addToLoadPath(paths);
+ var pathCount = paths.length;
+ var pathSearchCount = 0;
var self = this;
paths.forEach(function(path) {
readEachFileMatching(expr, path, function(err, file, stat, content) {
if (err) throw err;
self._runFileContent(file, content, printers, completeHandler);
}, function(err) {
if (err) throw err;
- self._finish(printers);
+ // Only 'finish' if all paths have been searched:
+ if (++pathSearchCount >= pathCount) {
+ self._finish(printers);
+ }
});
});
}

0 comments on commit 3d9dbdc

Please sign in to comment.
Something went wrong with that request. Please try again.