mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:57:08 +00:00
Exit on start up errors
This commit is contained in:
@@ -8,6 +8,7 @@ async function main () {
|
||||
INFO("Running version", await version.describe());
|
||||
version.compatible()
|
||||
.then( (versions) => {
|
||||
try {
|
||||
const api = require('./api');
|
||||
const ws = require('./ws');
|
||||
|
||||
@@ -19,12 +20,17 @@ async function main () {
|
||||
const server = api.start(port, host, path);
|
||||
ws.start(server);
|
||||
|
||||
INFO("Versions:", versions);
|
||||
|
||||
|
||||
process.on('exit', () => eventManager.kill());
|
||||
const eventManagerPath = [__dirname, "events"].join("/");
|
||||
const eventManager = fork(eventManagerPath, /*{ stdio: 'ignore' }*/);
|
||||
|
||||
INFO("Versions:", versions);
|
||||
|
||||
process.on('exit', () => eventManager.kill());
|
||||
} catch (err) {
|
||||
ERROR(err);
|
||||
process.exit(2);
|
||||
}
|
||||
})
|
||||
.catch( ({current, wanted, component}) => {
|
||||
console.error(`Fatal error: incompatible ${component} version ${current} (wanted: ${wanted})`);
|
||||
|
||||
Reference in New Issue
Block a user