{"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","tarball":"http://registry-npm.ywwl.com/death/download/death-1.1.0.tgz","integrity":"sha512-vsV6S4KVHvTGxbEcij7hkWRv0It+sGGWVOM67dQde/o5Xjnr+KmLjxWJii2uEObIrt1CcM9w0Yaovx+iOlIL+w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD7lCZfRM967Ut1OY6p3OZRUflfxfN+Fm6DuNoCzcImpQIgTavSTF1skz4DSvlr39YrpehswFPpqLQl0SOYBf1a3mM="}],"size":4255,"noattachment":false,"key":"/death/-/death-1.1.0.tgz"},"maintainers":[{"name":"jprichardson","email":"jprichardson@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/death-1.1.0.tgz_1484762378597_0.8578907051123679"},"directories":{},"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","publish_time":1484762379260,"_cnpm_publish_time":1484762379260,"dist-tags":{"latest":"1.1.0"}}