{"_id":"death","_rev":"244946","name":"death","description":"Gracefully cleanup when termination signals are sent to your process.","dist-tags":{"latest":"1.1.0"},"maintainers":[{"name":"jprichardson","email":""}],"time":{"modified":"2021-06-03T16:02:27.000Z","created":"2012-12-01T08:28:33.126Z","1.1.0":"2017-01-18T17:59:39.260Z","1.0.0":"2015-03-17T15:35:41.808Z","0.1.0":"2013-02-18T20:01:31.118Z","0.0.1":"2012-12-01T08:28:33.126Z"},"users":{"honzajde":true,"ruyadorno":true,"tracker1":true,"skiqh":true,"tur-nr":true,"laomu":true,"iuykza":true,"heartnett":true,"soenkekluth":true,"virk":true,"ethzero":true,"rocket0191":true,"temasm":true,"geniusm4ster":true,"isayme":true,"gamersdelight":true},"author":{"name":"JP Richardson","email":"jprichardson@gmail.com"},"repository":{"type":"git","url":"git+ssh://git@github.com/jprichardson/node-death.git"},"versions":{"1.1.0":{"name":"death","version":"1.1.0","description":"Gracefully cleanup when termination signals are sent to your process.","repository":{"type":"git","url":"git+ssh://git@github.com/jprichardson/node-death.git"},"keywords":["sigint","sigterm","sigkill","sigquit","exception","kill","terminate","process","clean"],"author":{"name":"JP Richardson","email":"jprichardson@gmail.com"},"licenses":[{"type":"MIT","url":""}],"dependencies":{},"devDependencies":{"win-spawn":"~1.1.1","autoresolve":"0.0.3","testutil":"~0.4.0","colors":"~0.6.0-1"},"main":"./lib/death.js","scripts":{"test":"mocha test"},"gitHead":"f9453b68b8168def79fa8350f294e2b757f64d75","bugs":{"url":"https://github.com/jprichardson/node-death/issues"},"homepage":"https://github.com/jprichardson/node-death#readme","_id":"death@1.1.0","_shasum":"01aa9c401edd92750514470b8266390c66c67318","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.5.0","_npmUser":{"name":"jprichardson","email":"jprichardson@gmail.com"},"dist":{"shasum":"01aa9c401edd92750514470b8266390c66c67318","size":4255,"noattachment":false,"key":"/death/-/death-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/death/download/death-1.1.0.tgz"},"maintainers":[{"name":"jprichardson","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/death-1.1.0.tgz_1484762378597_0.8578907051123679"},"directories":{},"publish_time":1484762379260,"_cnpm_publish_time":1484762379260,"_hasShrinkwrap":false},"1.0.0":{"name":"death","version":"1.0.0","description":"Gracefully cleanup when termination signals are sent to your process.","repository":{"type":"git","url":"git@github.com:jprichardson/node-death.git"},"keywords":["sigint","sigterm","sigkill","sigquit","exception","kill","terminate","process","clean"],"author":{"name":"JP Richardson","email":"jprichardson@gmail.com"},"licenses":[{"type":"MIT","url":""}],"dependencies":{},"devDependencies":{"win-spawn":"~1.1.1","autoresolve":"0.0.3","testutil":"~0.4.0","colors":"~0.6.0-1"},"main":"./lib/death.js","scripts":{"test":"mocha test"},"gitHead":"5b7e8a035724a7c1883189c5c492c61d670176d4","bugs":{"url":"https://github.com/jprichardson/node-death/issues"},"homepage":"https://github.com/jprichardson/node-death","_id":"death@1.0.0","_shasum":"4d46e15488d4b636b699f0671b04632d752fd2de","_from":".","_npmVersion":"2.3.0","_nodeVersion":"0.10.32","_npmUser":{"name":"jprichardson","email":"jprichardson@gmail.com"},"maintainers":[{"name":"jprichardson","email":""}],"dist":{"shasum":"4d46e15488d4b636b699f0671b04632d752fd2de","size":4084,"noattachment":false,"key":"/death/-/death-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/death/download/death-1.0.0.tgz"},"directories":{},"publish_time":1426606541808,"_cnpm_publish_time":1426606541808,"_hasShrinkwrap":false},"0.1.0":{"name":"death","version":"0.1.0","description":"Gracefully cleanup when termination signals are sent to your process.","homepage":[""],"repository":{"type":"git","url":"git@github.com:jprichardson/node-death.git"},"keywords":["sigint","sigterm","sigkill","sigquit","exception","kill","terminate","process","clean"],"author":{"name":"JP Richardson","email":"jprichardson@gmail.com"},"licenses":[{"type":"MIT","url":""}],"dependencies":{},"devDependencies":{"win-spawn":"~1.1.1","autoresolve":"0.0.3","testutil":"~0.4.0","colors":"~0.6.0-1"},"main":"./lib/death.js","scripts":{"test":"mocha test"},"readmeFilename":"README.md","_id":"death@0.1.0","dist":{"shasum":"5c2ff76c1eae11c092dda5a9f3e05d0bf816795e","size":4056,"noattachment":false,"key":"/death/-/death-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/death/download/death-0.1.0.tgz"},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"jp","email":"jprichardson@gmail.com"},"maintainers":[{"name":"jprichardson","email":""}],"directories":{},"publish_time":1361217691118,"_cnpm_publish_time":1361217691118,"_hasShrinkwrap":false},"0.0.1":{"name":"death","version":"0.0.1","description":"Gracefully cleanup when termination signals are sent to your process.","homepage":[""],"repository":{"type":"git","url":"git@github.com:jprichardson/node-death.git"},"keywords":["sigint","sigterm","sigkill","sigquit","exception","kill","terminate","process","clean"],"author":{"name":"JP Richardson","email":"jprichardson@gmail.com"},"licenses":[{"type":"MIT","url":""}],"dependencies":{},"devDependencies":{},"main":"./lib/death.js","scripts":{"test":"mocha test"},"readmeFilename":"README.md","_id":"death@0.0.1","dist":{"shasum":"eeaa1a846300c0fa9d2f291efe84f53f71122628","size":2911,"noattachment":false,"key":"/death/-/death-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/death/download/death-0.0.1.tgz"},"_npmVersion":"1.1.68","_npmUser":{"name":"jp","email":"jprichardson@gmail.com"},"maintainers":[{"name":"jprichardson","email":""}],"directories":{},"publish_time":1354350513126,"_cnpm_publish_time":1354350513126,"_hasShrinkwrap":false}},"readme":"Node.js - death\n================\n\nGracefully cleanup when termination signals are sent to your process.\n\n\nWhy?\n----\n\nBecause adding clean up callbacks for `uncaughtException`, `SIGINT`, and `SIGTERM` is annoying. Ideally, you can\nuse this package to put your cleanup code in one place and exit gracefully if you need to.\n\n\nOperating System Compatibility\n------------------------------\n\nIt's only been tested on POSIX compatible systems. [Here's a nice discussion](https://github.com/joyent/node/issues/1553) on Windows signals, apparently, this has been fixed/mapped. \n\n\nInstallation\n------------\n\n    npm install death\n\n\n\nExample\n------\n\n```js\nvar ON_DEATH = require('death'); //this is intentionally ugly\n\nON_DEATH(function(signal, err) {\n  //clean up code here\n})\n```\n\n\nUsage\n-----\n\nBy default, it sets the callback on `SIGINT`, `SIGQUIT`, and `SIGTERM`.\n\n### Signals\n- **SIGINT**: Sent from CTRL-C\n- **SIGQUIT**: Sent from keyboard quit action.\n- **SIGTERM**: Sent from operating system `kill`.\n\nMore discussion and detail: http://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html and http://pubs.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html and http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap11.html.\n\nAS they pertain to Node.js: http://dailyjs.com/2012/03/15/unix-node-signals/\n\n\n#### Want to catch uncaughtException?\n\nNo problem, do this:\n\n```js\nvar ON_DEATH = require('death')({uncaughtException: true}) \n```\n\n#### Want to know which signals are being caught?\n\nDo this:\n\n```js\nvar ON_DEATH = require('death')({debug: true})\n```\n\nYour process will then log anytime it catches these signals.\n\n#### Want to catch SIGHUP?\n\nBe careful with this one though. Typically this is fired if your SSH connection dies, but can\nalso be fired if the program is made a daemon. \n\nDo this:\n\n```js\nvar ON_DEATH = require('death')({SIGHUP: true})\n```\n\n#### Why choose the ugly \"ON_DEATH\"?\n\nName it whatever you want. I like `ON_DEATH` because it stands out like a sore thumb in my code.\n\n\n#### Want to remove event handlers?\n\nIf you want to remove event handlers `ON_DEATH` returns a function for cleaning\nup after itself:\n\n```js\nvar ON_DEATH = require('death')\nvar OFF_DEATH = ON_DEATH(function(signal, err) {\n  //clean up code here\n})\n\n// later on...\nOFF_DEATH();\n```\n\nLicense\n-------\n\n(MIT License)\n\nCopyright 2012, JP Richardson  <jprichardson@gmail.com>\n\n\n","_attachments":{},"homepage":"https://github.com/jprichardson/node-death#readme","bugs":{"url":"https://github.com/jprichardson/node-death/issues"}}