@storm-software/config-tools
Version:
⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.
50 lines (37 loc) • 2.04 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});
var _chunkDLO4KL2Zcjs = require('./chunk-DLO4KL2Z.cjs');
var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
// src/utilities/process-handler.ts
var exitWithError = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (config) => {
_chunkDLO4KL2Zcjs.writeFatal.call(void 0, "Exiting script with an error status...", config);
process.exit(1);
}, "exitWithError");
var exitWithSuccess = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (config) => {
_chunkDLO4KL2Zcjs.writeSuccess.call(void 0, "Script completed successfully. Exiting...", config);
process.exit(0);
}, "exitWithSuccess");
var handleProcess = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (config) => {
_chunkDLO4KL2Zcjs.writeTrace.call(void 0, `Using the following arguments to process the script: ${process.argv.join(", ")}`, config);
process.on("unhandledRejection", (error) => {
_chunkDLO4KL2Zcjs.writeError.call(void 0, `An Unhandled Rejection occurred while running the program: ${error}`, config);
exitWithError(config);
});
process.on("uncaughtException", (error) => {
_chunkDLO4KL2Zcjs.writeError.call(void 0, `An Uncaught Exception occurred while running the program: ${error.message}
Stacktrace: ${error.stack}`, config);
exitWithError(config);
});
process.on("SIGTERM", (signal) => {
_chunkDLO4KL2Zcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
exitWithError(config);
});
process.on("SIGINT", (signal) => {
_chunkDLO4KL2Zcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
exitWithError(config);
});
process.on("SIGHUP", (signal) => {
_chunkDLO4KL2Zcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
exitWithError(config);
});
}, "handleProcess");
exports.exitWithError = exitWithError; exports.exitWithSuccess = exitWithSuccess; exports.handleProcess = handleProcess;