Permalink
Browse files

Ensure there is final callback

even if no files have been matched.
  • Loading branch information...
1 parent 66c607e commit 43af677fc2364c17637f5c6396a1225b8d33dc25 @pvorb committed Feb 17, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 bake.js
View
@@ -12,6 +12,7 @@ var bake = function(conf, hooks, cb) {
// File counter
var todo = 0;
+ var matched = 0;
if (typeof conf != 'object')
return cb(new Error('parameter conf must be a valid configuration object'));
@@ -55,6 +56,7 @@ var bake = function(conf, hooks, cb) {
// Increase file counter
++todo;
+ ++matched;
// Read the master-file's contents
fs.readFile(master, 'utf8', function(err, data) {
@@ -181,6 +183,9 @@ var bake = function(conf, hooks, cb) {
}
});
}
+ }, function () {
+ if (todo == 0)
+ return cb();
});
};

0 comments on commit 43af677

Please sign in to comment.