child.once( 'exit', (this._childExitHandler = function(code, signal) { child.removeListener('disconnect', this._childDisconnectHandler); clearTimeout(this._childDisconnectTimer); if (code > 0) { this.emit('error', new Error(code > 1 ? constants.findExitCode(code) : "Module '" + this._options.main + "' stopped unexpected")); } else { this.emit('stopped'); } }.bind(this)) );
this.worker.on('message', function callback(e) { _that.removeListener('message', callback); resolve(e); });
child.once( 'disconnect', (this._childDisconnectHandler = function() { this._childDisconnectTimer = setTimeout( function() { child.removeListener('exit', this._childExitHandler); if (this._sendSignal(pid)) { this.emit('started', pid); } else { this.emit('error', new Error('Daemon failed to start')); } }.bind(this), 100 ); }.bind(this)) );