diff --git a/lib/assert.js b/lib/assert.js index 4f6c46c9a7..0a8c19715e 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -23,7 +23,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // UTILITY - +var inherits = require('./sys').inherits; var pSlice = Array.prototype.slice; // 1. The assert module provides functions that throw @@ -47,7 +47,7 @@ assert.AssertionError = function AssertionError (options) { Error.captureStackTrace(this, stackStartFunction); } }; -process.inherits(assert.AssertionError, Error); +inherits(assert.AssertionError, Error); assert.AssertionError.prototype.toString = function() { if (this.message) { diff --git a/lib/http.js b/lib/http.js index 5e514e4be7..d9eab022ee 100644 --- a/lib/http.js +++ b/lib/http.js @@ -1,4 +1,4 @@ -var sys = require('sys'); +var sys = require('./sys'); var events = require('events'); var CRLF = "\r\n"; diff --git a/lib/sys.js b/lib/sys.js index 9c05342e48..4066ab917b 100644 --- a/lib/sys.js +++ b/lib/sys.js @@ -214,5 +214,12 @@ exports.exec = function (command, callback) { * prototype * @param {function} superCtor Constructor function to inherit prototype from */ -exports.inherits = process.inherits; +exports.inherits = function (ctor, superCtor) { + var tempCtor = function(){}; + tempCtor.prototype = superCtor.prototype; + ctor.super_ = superCtor; + ctor.prototype = new tempCtor(); + ctor.prototype.constructor = ctor; +}; + diff --git a/src/node.js b/src/node.js index ceae632983..a1054206c8 100644 --- a/src/node.js +++ b/src/node.js @@ -27,6 +27,7 @@ GLOBAL.node = {}; node.createProcess = removed("node.createProcess() has been changed to process.createChildProcess() update your code"); node.exec = removed("process.exec() has moved. Use require('sys') to bring it back."); node.inherits = removed("node.inherits() has moved. Use require('sys') to access it."); +process.inherits = removed("process.inherits() has moved to sys.inherits."); node.http = {}; node.http.createServer = removed("node.http.createServer() has moved. Use require('http') to access it."); @@ -72,15 +73,6 @@ function createInternalModule (id, constructor) { }; -process.inherits = function (ctor, superCtor) { - var tempCtor = function(){}; - tempCtor.prototype = superCtor.prototype; - ctor.super_ = superCtor; - ctor.prototype = new tempCtor(); - ctor.prototype.constructor = ctor; -}; - - process.createChildProcess = function (file, args, env) { var child = new process.ChildProcess(); args = args || [];