Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ls: Exit with error when problems are found

Fix #2798
  • Loading branch information...
commit 0fc2c2df0ca4ed11d3203eb69c8858749aa6234b 1 parent 3701086
@isaacs isaacs authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/ls.js
View
10 lib/ls.js
@@ -36,6 +36,7 @@ function ls (args, silent, cb) {
readInstalled(dir, npm.config.get("depth"), function (er, data) {
var bfs = bfsify(data, args)
, lite = getLite(bfs)
+
if (er || silent) return cb(er, data, lite)
var long = npm.config.get("long")
@@ -58,7 +59,12 @@ function ls (args, silent, cb) {
out = makeArchy(bfs, long, dir)
}
console.log(out)
- cb(null, data, lite)
+
+ // if any errors were found, then complain and exit status 1
+ if (lite.problems && lite.problems.length) {
+ er = lite.problems.join('\n')
+ }
+ cb(er, data, lite)
})
}
@@ -210,7 +216,6 @@ function makeArchy_ (data, long, dir, depth, parent, d) {
if (depth < npm.config.get("depth")) {
// just missing
var p = parent.link || parent.path
- log.warn("unmet dependency", "%s in %s", d+" "+data, p)
var unmet = "UNMET DEPENDENCY"
if (color) {
unmet = "\033[31;40m" + unmet + "\033[0m"
@@ -303,7 +308,6 @@ function makeParseable_ (data, long, dir, depth, parent, d) {
if (typeof data === "string") {
if (data.depth < npm.config.get("depth")) {
var p = parent.link || parent.path
- log.warn("unmet dependency", "%s in %s", d+" "+data, p)
data = npm.config.get("long")
? path.resolve(parent.path, "node_modules", d)
+ ":"+d+"@"+JSON.stringify(data)+":INVALID:MISSING"
Please sign in to comment.
Something went wrong with that request. Please try again.