Skip to content

Commit

Permalink
Remove exit module
Browse files Browse the repository at this point in the history
  • Loading branch information
smfreegard committed Mar 10, 2016
1 parent e5daaca commit 9c6f6b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 2 additions & 4 deletions haraka.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('.');
Expand Down Expand Up @@ -37,15 +36,15 @@ 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) {
process.on(sig, function () {
process.title = path.basename(process.argv[1], '.js');
logger.lognotice(sig + ' received');
logger.dump_logs();
exit(1);
proces.exit(1);
});
});

Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : "*",
Expand Down
11 changes: 5 additions & 6 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -72,7 +71,7 @@ Server.daemonize = function () {
}
catch (err) {
logger.logerror(err.message);
exit(1);
process.exit(1);
}
};

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit 9c6f6b4

Please sign in to comment.