arunoda / node-usage

process usage lookup with nodejs
MIT License
389 stars 93 forks source link

Only invoke callback once on error #56

Closed BlueWinds closed 3 years ago

BlueWinds commented 8 years ago

On a mac:

var usage = require('usage');
usage.lookup(process.pid, function(err, usage) {
    console.log(err);
    throw new TypeError();
});

// results in:
// null
// [TypeError]

The callback has been invoked twice, once with its own error. This pull request fixes the issue.