Skip to content

Commit

Permalink
fix: auto stops after error #988
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Dec 30, 2015
1 parent f556b20 commit f360e0d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@
var results = {};
var runningTasks = 0;

var hasError = false;

var listeners = [];
function addListener(fn) {
listeners.unshift(fn);
Expand All @@ -550,6 +552,7 @@
});

_arrayEach(keys, function (k) {
if (hasError) return;
var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];
var taskCallback = _restParam(function(err, args) {
runningTasks--;
Expand All @@ -562,6 +565,8 @@
safeResults[rkey] = val;
});
safeResults[k] = args;
hasError = true;

callback(err, safeResults);
}
else {
Expand Down

0 comments on commit f360e0d

Please sign in to comment.