@storm-software/config-tools
Version:
A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.
56 lines (45 loc) • 1.81 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});
var _chunkDLJF3QQScjs = require('./chunk-DLJF3QQS.cjs');
// src/utilities/process-handler.ts
var exitWithError = (config) => {
_chunkDLJF3QQScjs.writeFatal.call(void 0, "Exiting script with an error status...", config);
process.exit(1);
};
var exitWithSuccess = (config) => {
_chunkDLJF3QQScjs.writeSuccess.call(void 0, "Script completed successfully. Exiting...", config);
process.exit(0);
};
var handleProcess = (config) => {
_chunkDLJF3QQScjs.writeTrace.call(void 0,
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
config
);
process.on("unhandledRejection", (error) => {
_chunkDLJF3QQScjs.writeError.call(void 0,
`An Unhandled Rejection occurred while running the program: ${error}`,
config
);
exitWithError(config);
});
process.on("uncaughtException", (error) => {
_chunkDLJF3QQScjs.writeError.call(void 0,
`An Uncaught Exception occurred while running the program: ${error.message}
Stacktrace: ${error.stack}`,
config
);
exitWithError(config);
});
process.on("SIGTERM", (signal) => {
_chunkDLJF3QQScjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
exitWithError(config);
});
process.on("SIGINT", (signal) => {
_chunkDLJF3QQScjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
exitWithError(config);
});
process.on("SIGHUP", (signal) => {
_chunkDLJF3QQScjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
exitWithError(config);
});
};
exports.exitWithError = exitWithError; exports.exitWithSuccess = exitWithSuccess; exports.handleProcess = handleProcess;