UNPKG

auth0-tenant-to-tenant-user-migration-tool

Version:
28 lines 953 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = withGracefulExit; const logger_1 = __importDefault(require("./logger")); function withGracefulExit(fn) { return (async (...args) => { process.once('SIGINT', () => { logger_1.default.info('Gracefully shutting down...'); process.exit(0); }); try { await fn(...args); } catch (err) { if (err.message === 'User force closed the prompt with SIGINT') { logger_1.default.info('Migration cancelled by user.'); } else { logger_1.default.error('An error occurred:', err); } process.exit(1); } }); } //# sourceMappingURL=with-graceful-exit.js.map