Skip to content

Commit

Permalink
bin: only add log listener once
Browse files Browse the repository at this point in the history
Makes the test stop complaining.  Irrelevant in most other scenarios.
  • Loading branch information
isaacs committed Nov 27, 2019
1 parent 8a8cd6a commit ccc9e20
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@ const shouldJSON = (conf, result) =>
const pretty = (conf, result) =>
shouldJSON(conf, result) ? JSON.stringify(result, 0, 2) : result

let addedLogListener = false
const main = args => {
const conf = parse(args)
if (conf.help || conf.h)
return console.log(usage())

process.on('log', console.error)
if (!addedLogListener) {
process.on('log', console.error)
addedLogListener = true
}

try {
return run(conf)
Expand Down

0 comments on commit ccc9e20

Please # to comment.