From 3c6b8a521561f5341652ffe37b869d5ab457227b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 2 Jun 2014 17:58:43 +0200 Subject: nix-env -qa --json: Generate valid JSON even if there are invalid meta attrs --- src/nix-env/nix-env.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nix-env/nix-env.cc') diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 2d38f2aea..05f6aa354 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -882,9 +882,10 @@ static void queryJSON(Globals & globals, vector & elems) foreach (StringSet::iterator, j, metaNames) { metaObj.attr(*j); Value * v = i->queryMeta(*j); - if (!v) + if (!v) { printMsg(lvlError, format("derivation `%1%' has invalid meta attribute `%2%'") % i->name % *j); - else { + cout << "null"; + } else { PathSet context; printValueAsJSON(globals.state, true, *v, cout, context); } -- cgit v1.2.3