Comparing version 0.1.0 to 0.2.0
22
index.js
@@ -84,3 +84,4 @@ #!/usr/bin/env node | ||
process.on('SIGINT', function () { | ||
function dump() { | ||
console.log('[WTF Node?] open handles:'); | ||
@@ -162,7 +163,20 @@ | ||
} | ||
process.exit(); | ||
}); | ||
} | ||
function init() { | ||
process.on('SIGINT', function () { | ||
try { dump(); } | ||
catch (e) { console.error(e); } | ||
process.exit(); | ||
}); | ||
} | ||
module.exports = { | ||
dump: dump, | ||
init: init | ||
}; | ||
if (module === require.main && process.argv[2]) { | ||
init(); | ||
var fn = process.argv[2], PATH = require('path'); | ||
@@ -169,0 +183,0 @@ if (!/^\//.test(fn)) { |
{ | ||
"name": "wtfnode", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Utility to help find out why Node isn't exiting", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -37,12 +37,18 @@ # What? | ||
# Usage | ||
# Command line usage | ||
You can install as a global module (`npm install -g wtfnode`) and call a node script manually: `wtfnode <yourscript>` | ||
If you do this, `wtfnode` will load itself, then `require()` the script you specified. | ||
If you do this, `wtfnode` will load itself, then `require()` the script you specified. When you are ready, send SIGINT (Ctrl+C). The process will exit, and the active handles at the time of exit will be printed out. | ||
Alternately, you can load it as a module, using `require()` at the entry point of your own app: `require('wtfnode')`; if you do this, you only need install it locally. | ||
# Module usage | ||
Once `wtfnode` is loaded, all you need do is send SIGINT (Ctrl+C). The process will exit, and the active handles at the time of exit will be printed out. | ||
Install as a local module (`npm install wtfnode`). | ||
Require the module: `var wtf = require('wtfnode');` | ||
When you are ready, call `wtf.dump()` to dump open handles. Note that if you call this from a timer, the timer itself may show up! | ||
**Important**: Require at the entry point of your application. You must do this before loading / referencing even native node modules, or certain hooks may not be effective. | ||
# Caution | ||
@@ -49,0 +55,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9651
5
163
62