From f360e0d6d21c0fd9942252358d03b223a8ea42e7 Mon Sep 17 00:00:00 2001 From: Gregor Martynus Date: Wed, 30 Dec 2015 17:06:40 +0100 Subject: [PATCH] fix: auto stops after error #988 --- lib/async.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/async.js b/lib/async.js index 3748ac070..9ecbda69d 100644 --- a/lib/async.js +++ b/lib/async.js @@ -528,6 +528,8 @@ var results = {}; var runningTasks = 0; + var hasError = false; + var listeners = []; function addListener(fn) { listeners.unshift(fn); @@ -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--; @@ -562,6 +565,8 @@ safeResults[rkey] = val; }); safeResults[k] = args; + hasError = true; + callback(err, safeResults); } else {