This repository has been archived by the owner. It is now read-only.

domain: fix dispose call inside another domain #4153

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+17 −1
Split
View
@@ -210,7 +210,7 @@ Domain.prototype.dispose = function() {
if (this._disposed) return;
// if we're the active domain, then get out now.
- this.exit();
+ if (exports.active === this) this.exit();
this.emit('dispose');
@@ -0,0 +1,16 @@
+
+var domain = require('domain');
+var assert = require('assert');
+
+var d = domain.create();
+
+d.run(function () {
+
+ var dd = domain.create();
+ dd.run(function () {
+ d.dispose();
+
+ assert.strictEqual(domain.active, dd);
+ });
+});
+