mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Fix Aphlict exit status
Summary: Fixes T6998. Based on https://groups.google.com/d/msg/nodejs/zF7GEoPccqw/n26c6gPaluwJ. Test Plan: Ran Aphlict and forced an error. Saw error messages in the logs and also saw a non-zero exit status. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6998 Differential Revision: https://secure.phabricator.com/D11456
This commit is contained in:
parent
e90695fc83
commit
f61846b469
1 changed files with 9 additions and 1 deletions
|
@ -43,6 +43,12 @@ var debug = new JX.AphlictLog()
|
|||
|
||||
var config = parse_command_line_arguments(process.argv);
|
||||
|
||||
function set_exit_code(code) {
|
||||
process.on('exit', function() {
|
||||
process.exit(code);
|
||||
});
|
||||
}
|
||||
|
||||
process.on('uncaughtException', function(err) {
|
||||
var context = null;
|
||||
if (err.code == 'EACCES' && err.path == config.log) {
|
||||
|
@ -61,6 +67,7 @@ process.on('uncaughtException', function(err) {
|
|||
message.push(err.stack);
|
||||
|
||||
debug.log(message.join('\n\n'));
|
||||
set_exit_code(1);
|
||||
});
|
||||
|
||||
try {
|
||||
|
@ -98,7 +105,8 @@ if (config.log) {
|
|||
// servers.
|
||||
if (config.test) {
|
||||
debug.log('Configuration test OK.');
|
||||
process.exit(0);
|
||||
set_exit_code(0);
|
||||
return;
|
||||
}
|
||||
|
||||
var server;
|
||||
|
|
Loading…
Reference in a new issue