From 535e109a3ab8cc756504a9204fdcd428cbae7cba Mon Sep 17 00:00:00 2001 From: Andreas Madsen Date: Fri, 8 Jun 2012 20:06:10 +0200 Subject: [PATCH] domain: run now return callback result both domain.bind and domain.intercept act this way --- lib/domain.js | 2 +- test/simple/test-domain.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/domain.js b/lib/domain.js index d1c8959627..7c4a85226a 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -136,7 +136,7 @@ Domain.prototype.remove = function(ee) { }; Domain.prototype.run = function(fn) { - this.bind(fn)(); + return this.bind(fn)(); }; Domain.prototype.intercept = function(cb) { diff --git a/test/simple/test-domain.js b/test/simple/test-domain.js index 72d7655dfa..4e984b2955 100644 --- a/test/simple/test-domain.js +++ b/test/simple/test-domain.js @@ -199,6 +199,10 @@ d.run(function() { }); }); +var result = d.run(function () { + return 'return value'; +}); +assert.equal(result, 'return value'); var fst = fs.createReadStream('stream for nonexistent file')