Socket
Socket
Sign inDemoInstall

node-cleanup

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-cleanup - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

26

node-cleanup.js

@@ -7,8 +7,27 @@ /**

*
* Call this function multiple times to install multiple cleanup handlers.
* Only the messages provided with the first call are used.
*
* See https://github.com/jtlapp/node-cleanup for more information. Code
* largely borrowed from http://stackoverflow.com/a/21947851/650894.
*/
var installed = false;
module.exports = function nodeCleanup(cleanupHandler, messages) {
// attach user callback to the process event emitter.
// if no callback, it will still exit gracefully on Ctrl-C
cleanupHandler = cleanupHandler || noOp;
process.on('cleanup', cleanupHandler);
// only install the termination handlers once
if (!installed) {
install(messages);
installed = true;
}
};
function install(messages) {
messages = messages || {};

@@ -20,7 +39,2 @@ if (typeof messages.ctrl_C !== 'string')

// attach user callback to the process event emitter.
// if no callback, it will still exit gracefully on Ctrl-C
cleanupHandler = cleanupHandler || noOp;
process.on('cleanup', cleanupHandler);
// do app-specific cleaning before exiting

@@ -46,4 +60,4 @@ process.on('exit', function () {

});
};
}
function noOp() {}; // for just the benefit of graceful SIGINTs
{
"name": "node-cleanup",
"version": "1.0.0",
"version": "1.0.1",
"description": "installs a cleanup handler that always runs on exiting node",

@@ -5,0 +5,0 @@ "main": "node-cleanup.js",

@@ -15,2 +15,4 @@ # node-cleanup

You may call nodeCleanup() multiple times to install multiple cleanup handlers, but only the messages provided with the first call get used.
```js

@@ -42,2 +44,4 @@ var nodeCleanup = require('node-cleanup');

Call this function multiple times to install multiple cleanup handlers. Only the messages provided with the first call are used.
| Param | Description |

@@ -44,0 +48,0 @@ | --- | --- |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc