mirror of
https://github.com/lehanspb/tuya-mqtt.git
synced 2025-12-16 17:54:36 +00:00
Dev (#60)
3.0.1 Update * Script to merge device additions and changes into devices.conf (#49) * Fix typos in README.md * Add republish on reconnect * Filter additional invalid characters '+','#','/' from topic line (replace with '_') * Minor bugfixes for parse values * Include script for merging new devices into existing config * Update dependency Co-authored-by: tsightler <tsightler@gmail.com> Co-authored-by: Doug Krahmer <doug.git@remhark.com>
This commit is contained in:
29
cleanup.js
29
cleanup.js
@@ -1,29 +0,0 @@
|
||||
// Object to capture process exits and call app specific cleanup function
|
||||
var debug = require('debug')('Cleanup');
|
||||
|
||||
function noOp() {};
|
||||
|
||||
exports.Cleanup = function Cleanup(callback) {
|
||||
|
||||
// attach user callback to the process event emitter
|
||||
// if no callback, it will still exit gracefully on Ctrl-C
|
||||
callback = callback || noOp;
|
||||
process.on('cleanup', callback);
|
||||
|
||||
// do app specific cleaning before exiting
|
||||
process.on('exit', function () {
|
||||
process.emit('cleanup');
|
||||
});
|
||||
|
||||
// catch ctrl+c event and exit normally
|
||||
process.on('SIGINT', function () {
|
||||
debug('Ctrl-C...');
|
||||
process.exit(2);
|
||||
});
|
||||
|
||||
//catch uncaught exceptions, trace, then exit normally
|
||||
process.on('uncaughtException', function (e) {
|
||||
debug('Uncaught Exception...', e.stack);
|
||||
process.exit(99);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user