Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate domains #75

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/api/domain.markdown
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Domain

Stability: 2 - Unstable
Stability: 0 - Deprecated

**IMPORTANT:** The domain module is deprecated and may be removed in
the future.

Domains provide a way to handle multiple different IO operations as a
single group. If any of the event emitters or callbacks registered to a
Expand Down
7 changes: 4 additions & 3 deletions lib/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ process._setupDomainUse(_domain, _domain_flag);

exports.Domain = Domain;

exports.create = exports.createDomain = function() {
exports.create = exports.createDomain = util.deprecate(function() {
return new Domain();
};
}, 'The domain module is deprecated and may be removed in future versions.');

// it's possible to enter one domain while already inside
// another one. the stack is each entered domain.
Expand Down Expand Up @@ -290,4 +290,5 @@ Domain.prototype.dispose = util.deprecate(function() {
// mark this domain as 'no longer relevant'
// so that it can't be entered or activated.
this._disposed = true;
});
}, 'domain.dispose() is deprecated. Please recover from failed IO actions ' +
'explicitly via error event handlers set on the domain.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the advice we want to give?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is copied directly from the documentation in doc/api/domain.markdown (d86814a)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. Can you amend the commit log to mention that?

EDIT: On a general note, commit logs should explain what changed and why. One-liners are almost never sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added some more info to the commit message.

4 changes: 2 additions & 2 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var path = require('path');
var fs = require('fs');
var rl = require('readline');
var Console = require('console').Console;
var domain = require('domain');
var Domain = require('domain').Domain;
var debug = util.debuglog('repl');

// If obj.hasOwnProperty has been overridden, then calling
Expand Down Expand Up @@ -102,7 +102,7 @@ function REPLServer(prompt, stream, eval_, useGlobal, ignoreUndefined) {

var self = this;

self._domain = dom || domain.create();
self._domain = dom || new Domain();

self.useGlobal = !!useGlobal;
self.ignoreUndefined = !!ignoreUndefined;
Expand Down
35 changes: 35 additions & 0 deletions test/simple/test-repl-no-deprecation-messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright io.js contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;

var child = spawn(process.execPath, [ '-i' ]);

child.stderr.setEncoding('utf8');
child.stderr.on('data', function (stderr) {
assert.equal(stderr, '');
});

child.stdout.once('data', function () {
child.kill('SIGINT');
});