mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 00:46:01 +00:00
dbmodel tool initial import
This commit is contained in:
16
packages/dbmodel/lib/runAndExit.js
Normal file
16
packages/dbmodel/lib/runAndExit.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const { createLogger } = require('pinomin');
|
||||
|
||||
const logger = createLogger('runAndExit');
|
||||
|
||||
async function runAndExit(promise) {
|
||||
try {
|
||||
await promise;
|
||||
logger.info('Success');
|
||||
process.exit();
|
||||
} catch (err) {
|
||||
logger.error({ err }, 'Processing failed');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = runAndExit;
|
||||
Reference in New Issue
Block a user