From ccc9e20e4c81c5698aecc6be28e119c23c32a143 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 27 Nov 2019 15:38:28 -0800 Subject: [PATCH] bin: only add log listener once Makes the test stop complaining. Irrelevant in most other scenarios. --- lib/bin.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/bin.js b/lib/bin.js index 0069bb37..2ccedd37 100755 --- a/lib/bin.js +++ b/lib/bin.js @@ -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)