From d71e31b5b50ee3dfb98512155af49a97d0edc491 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Thu, 31 Jan 2013 12:24:42 -0800 Subject: [PATCH] Make inFiber help pass arguments through. This fixes with_password in meteor deploy/logs/mongo. --- app/lib/fiber-helpers.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/lib/fiber-helpers.js b/app/lib/fiber-helpers.js index ff847f3c0f..863a68fb54 100644 --- a/app/lib/fiber-helpers.js +++ b/app/lib/fiber-helpers.js @@ -8,14 +8,19 @@ Error.stackTraceLimit = Infinity; // http://code.google.com/p/v8/wiki/JavaScript var Fiber = require("fibers"); -// runs a function within a fiber. we wrap the entry point into meteor.js into a fiber -// but if you use callbacks that call synchronous code you need to wrap those as well. +// runs a function within a fiber. we wrap the entry point into +// meteor.js into a fiber but if you use callbacks that call synchronous +// code you need to wrap those as well. // // NOTE: It's probably better to not use callbacks. Instead you can // use Futures to generate synchronous equivalents. exports.inFiber = function(func) { - return function() { - new Fiber(func).run(); + return function(/*arguments*/) { + var self = this; + var args = arguments; + new Fiber(function () { + func.apply(self, args); + }).run(); }; };