From d6c77ac14e2375ace6d6d89c4c2b8d84a2fd8b05 Mon Sep 17 00:00:00 2001 From: Steve Freegard Date: Thu, 10 Mar 2016 22:42:34 +0000 Subject: [PATCH] Remove exit module --- haraka.js | 6 ++---- package.json | 3 +-- server.js | 11 +++++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/haraka.js b/haraka.js index 1c21e992d9..b75970466b 100644 --- a/haraka.js +++ b/haraka.js @@ -3,7 +3,6 @@ 'use strict'; var path = require('path'); -var exit = require('exit'); // this must be set before "server.js" is loaded process.env.HARAKA = process.env.HARAKA || path.resolve('.'); @@ -37,7 +36,7 @@ process.on('uncaughtException', function (err) { logger.logcrit('Caught exception: ' + JSON.stringify(err)); } logger.dump_logs(); - exit(1); + process.exit(1); }); ['SIGTERM', 'SIGINT'].forEach(function (sig) { @@ -45,7 +44,7 @@ process.on('uncaughtException', function (err) { process.title = path.basename(process.argv[1], '.js'); logger.lognotice(sig + ' received'); logger.dump_logs(); - exit(1); + proces.exit(1); }); }); @@ -58,7 +57,6 @@ process.on('exit', function(code) { process.title = path.basename(process.argv[1], '.js'); logger.lognotice('Shutting down'); logger.dump_logs(); - exit(code); }); logger.log("NOTICE", "Starting up Haraka version " + exports.version); diff --git a/package.json b/package.json index 9bce508502..762b32a3b1 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,7 @@ "semver" : "~5.0.3", "sprintf-js" : "~1.0.3", "haraka-tld" : "*", - "haraka-constants" : "*", - "exit" : "~0.1.2" + "haraka-constants" : "*" }, "optionalDependencies": { "elasticsearch" : "*", diff --git a/server.js b/server.js index b10adf7361..5a7dd8699c 100644 --- a/server.js +++ b/server.js @@ -13,7 +13,6 @@ var cluster = require('cluster'); var async = require('async'); var daemon = require('daemon'); var path = require('path'); -var exit = require('exit'); // Need these here so we can run hooks logger.add_log_methods(exports, 'server'); @@ -72,7 +71,7 @@ Server.daemonize = function () { } catch (err) { logger.logerror(err.message); - exit(1); + process.exit(1); } }; @@ -186,7 +185,7 @@ Server.setup_smtp_listeners = function (plugins2, type, inactivity_timeout) { if (err) { logger.logerror("Failed to setup listeners: " + err.message); logger.dump_logs(); - exit(-1); + process.exit(-1); } Server.listening(); plugins2.run_hooks('init_' + type, Server); @@ -294,7 +293,7 @@ Server.init_master_respond = function (retval, msg) { if (!(retval === constants.ok || retval === constants.cont)) { Server.logerror("init_master returned error" + ((msg) ? ': ' + msg : '')); - exit(1); + process.exit(1); } var c = Server.cfg.main; @@ -312,7 +311,7 @@ Server.init_master_respond = function (retval, msg) { out.scan_queue_pids(function (err, pids) { if (err) { Server.logcrit("Scanning queue failed. Shutting down."); - exit(1); + process.exit(1); } Server.daemonize(); // Fork workers @@ -374,7 +373,7 @@ Server.init_child_respond = function (retval, msg) { catch (err) { Server.logerror('Terminating child'); } - exit(1); + process.exit(1); }; Server.listening = function () {