child_process: move binding init in constructor

Doing this in net.Socket constructor has much more overhead, and
error is actually may happen before the construction of socket object.
This commit is contained in:
Fedor Indutny 2013-01-28 21:22:59 +04:00
parent 4c78a52a3a
commit c13354e339
2 changed files with 4 additions and 4 deletions

View File

@ -668,6 +668,10 @@ function maybeClose(subprocess) {
function ChildProcess() {
EventEmitter.call(this);
// Initialize TCPWrap and PipeWrap
process.binding('tcp_wrap');
process.binding('pipe_wrap');
var self = this;
this._closesNeeded = 1;

View File

@ -142,10 +142,6 @@ function Socket(options) {
stream.Duplex.call(this, options);
if (options.handle) {
// Initialize TCPWrap and PipeWrap
process.binding('tcp_wrap');
process.binding('pipe_wrap');
this._handle = options.handle; // private
} else if (typeof options.fd !== 'undefined') {
this._handle = createPipe();