UNPKG

@clickup/pg-microsharding

Version:
24 lines 631 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.wrapSigInt = wrapSigInt; const logging_1 = require("./logging"); async function wrapSigInt(body) { let aborted = false; const onSigInt = () => { (0, logging_1.log)("SIGINT received."); aborted = true; }; const throwIfAborted = () => { if (aborted) { throw "Aborted due to SIGINT"; } }; process.on("SIGINT", onSigInt); try { return await body(throwIfAborted); } finally { process.off("SIGINT", onSigInt); } } //# sourceMappingURL=wrapSigInt.js.map