mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-17 10:58:31 -07:00
24 lines
625 B
JavaScript
24 lines
625 B
JavaScript
const semver = require('semver');
|
|
const engines = require('./package.json').engines;
|
|
|
|
const version = engines.node;
|
|
if (!semver.satisfies(process.version, version)) {
|
|
console.log(`\t\tZigbee2mqtt requires node version ${version}, you are running ${process.version}!\n`); // eslint-disable-line
|
|
}
|
|
|
|
const Controller = require('./lib/controller');
|
|
const controller = new Controller();
|
|
controller.start();
|
|
|
|
process.on('SIGINT', handleQuit);
|
|
process.on('SIGTERM', handleQuit);
|
|
|
|
let stopping = false;
|
|
|
|
function handleQuit() {
|
|
if (!stopping) {
|
|
stopping = true;
|
|
controller.stop(() => process.exit());
|
|
}
|
|
}
|