diff options
author | legodude17 <legodude17@users.noreply.github.com> | 2016-10-29 01:41:09 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-08-13 02:41:45 +0300 |
commit | bde15190230b5c62dbd98095311eab71f6b52321 (patch) | |
tree | 0d9634e9fb63c87d742f0de87cbc3211c57d52e7 /lib | |
parent | 55ac2fca81bf08338302dc7dc2070494e71add5c (diff) |
ping: improve output
This makes it much clearer when `npm ping` succeeds or fails.
PR-URL: https://github.com/npm/npm/pull/14461
Credit: @legodude17
Reviewed-By: @iarna
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ping.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ping.js b/lib/ping.js index e06be9a47..565430629 100644 --- a/lib/ping.js +++ b/lib/ping.js @@ -15,7 +15,13 @@ function ping (args, silent, cb) { var auth = npm.config.getCredentialsByURI(registry) npm.registry.ping(registry, {auth: auth}, function (er, pong, data, res) { - if (!silent) output(JSON.stringify(pong)) + if (!silent) { + if (er) { + output("Ping error: " + er) + } else { + output("Ping success: " + JSON.stringify(pong)) + } + } cb(er, er ? null : pong, data, res) }) } |