Skip to content

Commit

Permalink
fix(api): prevent MaxListenersExceededWarning
Browse files Browse the repository at this point in the history
- by moving the process.on outside of run function

Closes #597

Signed-off-by: Prokop Simek <prokop.simek@applifting.cz>
  • Loading branch information
prokopsimek committed Oct 29, 2019
1 parent 50b444e commit 2d1ef75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/npm-check-updates
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
'use strict';

require('node-alias')('ncu', __dirname, { message: false });
require('node-alias')('ncu', __dirname, {message: false});
13 changes: 6 additions & 7 deletions lib/npm-check-updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,13 @@ async function findPackage(options) {
return Promise.all([pkgData, pkgFile]);
}

/** main entry point */
async function run(options={}) {

// exit with non-zero error code when there is an unhandled promise rejection
process.on('unhandledRejection', err => {
throw err;
});
// exit with non-zero error code when there is an unhandled promise rejection
process.on('unhandledRejection', err => {
throw err;
});

/** main entry point */
async function run(options = {}) {
// if not executed on the command-line (i.e. executed as a node module), set some defaults
if (!options.cli) {
options = _.defaults({}, options, {
Expand Down

0 comments on commit 2d1ef75

Please sign in to comment.