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
diff options
context:
space:
mode:
authorEugene Sharygin <eush77@gmail.com>2015-06-12 10:52:27 +0300
committerForrest L Norvell <forrest@npmjs.com>2015-06-19 05:20:10 +0300
commit9d8cac94a258db648a2b1069b1c8c6529c79d013 (patch)
tree0d7613267dce391af9685c5ba06d87e1f734335b /lib/view.js
parent5018335ce1754a9f771954ecbc1a93acde9b8c0a (diff)
view: remove extra newline from output
PR-URL: https://github.com/npm/npm/pull/8548
Diffstat (limited to 'lib/view.js')
-rw-r--r--lib/view.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/view.js b/lib/view.js
index 47da39b64..9199d352a 100644
--- a/lib/view.js
+++ b/lib/view.js
@@ -254,7 +254,13 @@ function printData (data, name, cb) {
})
})
- console.log(msg)
+ // preserve output symmetry by adding a whitespace-only line at the end if
+ // there's one at the beginning
+ if (/^\s*\n/.test(msg)) msg += "\n"
+
+ // print directly to stdout to not unnecessarily add blank lines
+ process.stdout.write(msg)
+
cb(null, data)
}
function cleanup (data) {