Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2021-03-29 18:00:44 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-03-29 20:52:19 +0300
commit9dd2ed5189b6f283094664e9e192cf1598ec3f79 (patch)
tree2b6ec9c0a15b013aaba73cf52c35bbd43382145c /lib
parenta28f89572a708cced69cc938f877eaa969dbad9e (diff)
fix: empty newline printed to stderr
Starting in v7.7.0 running `npm` (no args) is printing an empty newline to stderr. This fixes that by correctly exiting via errorHandler and avoiding hitting the cb() never called error and adds a test to make sure we avoid that regression moving forward. Fixes: https://github.com/nodejs/node/pull/37678#issuecomment-808734374 Co-authored-by: Gar <gar+gh@danger.computer>
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/cli.js b/lib/cli.js
index 46859f150..f42132f94 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -61,9 +61,6 @@ module.exports = (process) => {
impl(npm.argv, errorHandler)
else {
try {
- // I don't know why this is needed but we get a cb() not called if we
- // omit it
- npm.log.level = 'silent'
if (cmd) {
const didYouMean = require('./utils/did-you-mean.js')
const suggestions = await didYouMean(npm, npm.localPrefix, cmd)
@@ -71,6 +68,7 @@ module.exports = (process) => {
} else
npm.output(npm.usage)
process.exitCode = 1
+ return errorHandler()
} catch (err) {
errorHandler(err)
}