Skip to content

Commit

Permalink
skyring: fix up the exitcode / lint
Browse files Browse the repository at this point in the history
  • Loading branch information
esatterwhite committed May 1, 2017
1 parent 9cb8617 commit fa62e7f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
* @requires skyring/lib/server
**/

const http = require('http')
, path = require('path')
, conf = require('./conf')
const conf = require('./conf')
, Server = require('./lib/server')
, debug = require('debug')('skyring')
;

module.exports = Server
module.exports = Server;

if( require.main === module ){
process.title = 'skyring';
Expand All @@ -27,19 +25,21 @@ if( require.main === module ){
const server = new Server();

server.load().listen(conf.get('PORT'),null, null, (err) => {
if(err) return console.log(err) || process.exit(1)
debug('server listening')
if(err) {
process.exitCode = 1;
console.error(err);
throw err;
}
debug('server listening');
});

function onSignal() {
server.close(()=>{
debug('shutting down')
process.statusCode = 0
})
debug('shutting down');
});
}
process.once('SIGINT', onSignal);
process.once('SIGTERM', onSignal);

}


Expand Down

0 comments on commit fa62e7f

Please sign in to comment.