diff --git a/lib/executor.js b/lib/executor.js index 10d328a..b9018fe 100644 --- a/lib/executor.js +++ b/lib/executor.js @@ -14,7 +14,7 @@ executor = async.queue(function (task, cb) { // Always tell the queue task is complete. Execute callback if any was given. if (typeof lastArg === 'function') { callback = function () { - lastArg(arguments); + lastArg.apply(null, arguments); cb(); }; @@ -50,11 +50,11 @@ function test2 (msg, cb) { setTimeout(function () { console.log("Ola " + msg); - callback(); + callback('YEAH'); }, 500); } -function bloup () { console.log("FINISHED"); } +function bloup () { console.log("FINISHED"); console.log(arguments); } executor.push({ this: null, fn: test1, arguments: [ 'world' ] }); executor.push({ this: null, fn: test2, arguments: [ 'world', bloup ] });