Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

wtfnode

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wtfnode - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

test.js

81

index.js

@@ -25,3 +25,3 @@ #!/usr/bin/env node

var hooked = function (_, stack) { return stack; };
Object.defineProperty(global, '__stack', {

@@ -60,9 +60,24 @@ get: function(){

var consolelog = console.log.bind(console);
function wrapFn(fn, name, isInterval) {
function wrapFn(fn, name, isInterval, callback) {
if (typeof fn !== 'function') { return fn; }
var wrapped = function () {
return fn.apply(this, arguments);
};
var wrapped = (
typeof callback === 'function' ?
function () {
callback.call(this, wrapped);
return fn.apply(this, arguments);
}
:
function () {
return fn.apply(this, arguments);
}
);
// This is intended to interact "cleverly" with node's EventEmitter logic.
// EventEmitter itself sometimes wraps the event handler callbacks to implement
// things such as once(). See https://github.com/nodejs/node/blob/v6.0.0/lib/events.js#L280
// In order for removeListener to still work when called with the original unwrapped function
// a .listener member is added to the stored callback which contains the original unwrapped function
// and the removeListener logic checks this member as well to match wrapped listeners.
var stack = __stack;

@@ -115,3 +130,3 @@

while (i--) { args[i] = arguments[i]; }
var ret = GLOBALS[type].apply(this, args);

@@ -134,13 +149,27 @@ var cbkey = timerCallback(ret);

EventEmitter.prototype.addListener = function (/*type, listener*/) {
var stack = __stack;
var args = [ ], i = arguments.length;
var args = [ ], i = arguments.length, fn;
while (i--) { args[i] = arguments[i]; }
if (typeof args[1] === 'function') {
args[1] = wrapFn(args[1], args[1].name, null);
args[1].listener = arguments[1];
}
return _EventEmitter_addListener.apply(this, args);
};
EventEmitter.prototype.once = function (/*type, listener*/) {
var args = [ ], i = arguments.length, fn;
while (i--) { args[i] = arguments[i]; }
var type = args[0], fn = args[1];
if (typeof fn === 'function') {
args[1] = wrapFn(fn, fn.name, null, function () {
this.removeListener(type, fn);
});
args[1].listener = arguments[1];
}
return _EventEmitter_addListener.apply(this, args);
};
})();

@@ -169,3 +198,3 @@

}
return ChildProcess;

@@ -178,3 +207,3 @@ })();

i = 0;
while (i < units.length && t / units[i] > 1) { t /= units[i++]; }

@@ -194,3 +223,3 @@ return Math.floor(t) + ' ' + labels[i-1];

console.log('[WTF Node?] open handles:');
// sort the active handles into different types for logging

@@ -209,7 +238,7 @@ var sockets = [ ], fds = [ ], servers = [ ], _timers = [ ], processes = [ ], other = [ ];

else if (h instanceof ChildProcess) { processes.push(h); }
// catchall
else { other.push(h); }
});
if (fds.length) {

@@ -235,3 +264,3 @@ console.log('- File descriptors: (note: stdio always exists)');

}
if (processes.length) {

@@ -277,3 +306,3 @@ console.log('- Child processes');

}
if (servers.length) {

@@ -309,3 +338,3 @@ console.log('- Servers:');

var listeners = s.listeners(eventType);
if (listeners && listeners.length) {

@@ -320,3 +349,3 @@ console.log(' - Listeners:');

}
var timers = [ ], intervals = [ ];

@@ -357,10 +386,10 @@ _timers.forEach(function (t) {

}
});
}
});
if (timers.length) {
console.log('- Timers:');
timers.forEach(function (t) {

@@ -376,6 +405,6 @@ var fn = t[timerCallback(t)],

}
if (intervals.length) {
console.log('- Intervals:');
intervals.forEach(function (t) {

@@ -391,3 +420,3 @@ var fn = t[timerCallback(t)],

}
if (other.length) {

@@ -394,0 +423,0 @@ console.log('- Others:');

var wtf = require('./index');
var fs = require('fs'),
var assert = require('assert');
cp = require('child_process'),
net = require('net'),
tls = require('tls'),
dgram = require('dgram'),
EventEmitter = require('events'),
fs = require('fs'),
http = require('http'),
https = require('https'),
dgram = require('dgram'),
readline = require('readline');
net = require('net'),
readline = require('readline'),
tls = require('tls');

@@ -60,2 +62,3 @@ function foo() { };

udpServer.on('message', function udpMessageListener() { });
udpServer.once('message', function onceHandler() { });
udpServer.on('listening', function () {

@@ -62,0 +65,0 @@ // open socket

{
"name": "wtfnode",
"version": "0.3.3",
"version": "0.3.4",
"description": "Utility to help find out why Node isn't exiting",

@@ -5,0 +5,0 @@ "repository": {

@@ -57,3 +57,3 @@ # What?

It currently does something useful under Node 0.12.2. If it stops doing something useful in the future, please post an issue, preferably with a reproducible test script and detailed version information, and I'll try and make it work properly again.
It currently does something useful under Node 0.10 through 5.11. If it stops doing something useful in the future, please post an issue, preferably with a reproducible test script and detailed version information, and I'll try and make it work properly again.

@@ -60,0 +60,0 @@ # Testing

Sorry, the diff of this file is not supported yet

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