bugfix: process.on("exit",function(code){

This commit is contained in:
想当当 2014-11-10 20:04:43 +08:00
parent 0e387382c8
commit bcb1f9d895
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "anyproxy", "name": "anyproxy",
"version": "2.8.3", "version": "2.8.4",
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.", "description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
"main": "proxy.js", "main": "proxy.js",
"bin": { "bin": {

View File

@ -150,8 +150,14 @@ function proxyServer(option){
//TODO : uncaught exception //TODO : uncaught exception
//kill web server when father process exits //kill web server when father process exits
process.on("exit uncaughtException",function(){ process.on("exit",function(code){
child_webServer.kill(); child_webServer.kill();
console.log('AnyProxy is about to exit with code:', code);
process.exit();
});
process.on("uncaughtException",function(err){
child_webServer.kill();
console.log('Caught exception: ' + err);
process.exit(); process.exit();
}); });