@alwatr/exit-hook
Version:
A utility for registering exit handlers in Node.js.
6 lines (4 loc) • 516 B
JavaScript
/* 📦 @alwatr/exit-hook v9.25.0 */
var q=null,y=!1;function D(f){if(q===null)B(),q=[];q.push(f)}function u(f){if(console.log("onExit({signal: %s})",f),y===!0||q===null)return;y=!0;for(let z of q)try{z()}catch(A){console.error("Error in exit hook callback:",A)}if(f==="SIGINT"||f==="SIGTERM")setTimeout(()=>{process.exit(0)})}function B(){process.once("exit",u),process.once("SIGTERM",u),process.once("SIGINT",u)}export{D as exitHook};
//# debugId=C5368E8EA230B7F964756E2164756E21
//# sourceMappingURL=main.js.map