Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
domain: run now return callback result
Browse files Browse the repository at this point in the history
both domain.bind and domain.intercept act this way
  • Loading branch information
AndreasMadsen authored and bnoordhuis committed Jun 9, 2012
1 parent 77cfbd9 commit 535e109
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/domain.js
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions test/simple/test-domain.js
Expand Up @@ -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')
Expand Down

0 comments on commit 535e109

Please sign in to comment.