Comparing version 0.0.5 to 0.0.7
@@ -185,2 +185,7 @@ | ||
}); | ||
worker.on( 'exit', function( code, signal ) { | ||
console.log( "Worker `" + worker.role.name + "` exits with code `" + code + "`, signal `" + signal + "`." ); | ||
self.onDeath( worker ); | ||
}); | ||
} | ||
@@ -191,4 +196,3 @@ | ||
cluster.on ( 'death', function ( worker ) | ||
{ | ||
self.onDeath = function( worker ) { | ||
var role = worker.role, x; | ||
@@ -209,5 +213,7 @@ if ( !role ) | ||
self.emit ( 'death', role.name, role.dead, worker ); | ||
}); | ||
}; | ||
cluster.on( 'death', self.onDeath ); | ||
//// API. | ||
@@ -214,0 +220,0 @@ |
@@ -178,3 +178,3 @@ | ||
if ( role && role.options && role.options.quarantine ) | ||
quarantine = require ( './quarantine' ) ( err.stack ); | ||
quarantine = require ( './quarantine' ) ( err.stack, quarantine ); | ||
@@ -181,0 +181,0 @@ if ( err.code !== 'EPIPE' ) |
@@ -10,4 +10,4 @@ | ||
**/ | ||
//// This is the quarantine block. | ||
@@ -23,3 +23,3 @@ //// @@ will get replaced by the file:line:char of the original error. | ||
module.exports = function ( stack ) | ||
module.exports = function ( stack, allowable ) | ||
{ | ||
@@ -44,12 +44,13 @@ | ||
while (( matches = pattern.exec ( stack ) )) | ||
{ | ||
while(( matches = pattern.exec( stack ) )) { | ||
process.stderr.write ( '\033[1;33m' + matches [ 2 ] + ' ...\033[0m\n' ); | ||
if ( matches [ 2 ].indexOf ( 'node_modules' ) >= 0 ) | ||
{ | ||
process.stderr.write ( '\033[1;31mQUARANTINE FAILS (TYPE A1).\033[0m\n' ); | ||
return false; | ||
} | ||
// never put external dependencies under quarantine | ||
if( matches[ 2 ].indexOf( 'node_modules' ) >= 0 ) | ||
process.stderr.write( '\033[1;31mQUARANTINE FAILS (TYPE A1).\033[0m\n' ); | ||
// use a regexp or other user provided test to narrow down the places where a quarnatine is allowable | ||
else if( allowable && typeof allowable.test === 'function' && !allowable.test( matches[ 2 ] ) ) | ||
process.stderr.write( '\033[1;31mQUARANTINE FAILS (USER FILENAME TEST).\033[0m\n' ); | ||
else try | ||
@@ -56,0 +57,0 @@ { |
{ "name" : "mob", | ||
"version" : "0.0.5", | ||
"version" : "0.0.7", | ||
"description" : "simple multi-process applications", | ||
@@ -4,0 +4,0 @@ "keywords" : [ "cluster", "child", "process", "message", "passing", "procfile" ], |
28421
659