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')