@ -289,24 +289,31 @@ var eventsModule = createInternalModule('events', function (exports) {
this . _ values = Array . prototype . slice . call ( arguments ) ;
this . _ values = Array . prototype . slice . call ( arguments ) ;
this . emit . apply ( this , [ 'error' ] . concat ( this . _ values ) ) ;
this . emit . apply ( this , [ 'error' ] . concat ( this . _ values ) ) ;
if ( this . listeners ( 'error' ) . length == 0 ) {
var self = this ;
process . nextTick ( function ( ) {
if ( self . listeners ( 'error' ) . length == 0 ) {
throw new Error ( 'Unhandled emitError: ' + JSON . stringify ( self . _ values ) ) ;
}
} ) ;
}
} ;
} ;
exports . Promise . prototype . addCallback = function ( listener ) {
exports . Promise . prototype . addCallback = function ( listener ) {
if ( ! this . hasFired ) {
if ( this . hasFired ) {
return this . addListener ( "success" , listener ) ;
return listener . apply ( this , this . _ values ) ;
}
}
listener . apply ( this , this . _ values ) ;
return this . addListener ( "success" , listener ) ;
return this ;
} ;
} ;
exports . Promise . prototype . addErrback = function ( listener ) {
exports . Promise . prototype . addErrback = function ( listener ) {
if ( ! this . hasFired ) {
if ( this . hasFired ) {
return this . addListener ( "error" , listener ) ;
listener . apply ( this , this . _ values ) ;
}
}
listener . apply ( this , this . _ values ) ;
return this . addListener ( "error" , listener ) ;
return this ;
} ;
} ;
/* Poor Man's coroutines */
/* Poor Man's coroutines */
@ -1010,10 +1017,6 @@ process.mainModule = createModule(".");
var loadPromise = new events . Promise ( ) ;
var loadPromise = new events . Promise ( ) ;
process . mainModule . load ( process . ARGV [ 1 ] , loadPromise ) ;
process . mainModule . load ( process . ARGV [ 1 ] , loadPromise ) ;
loadPromise . addErrback ( function ( e ) {
throw e ;
} ) ;
// All our arguments are loaded. We've evaluated all of the scripts. We
// All our arguments are loaded. We've evaluated all of the scripts. We
// might even have created TCP servers. Now we enter the main eventloop. If
// might even have created TCP servers. Now we enter the main eventloop. If
// there are no watchers on the loop (except for the ones that were
// there are no watchers on the loop (except for the ones that were