guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

17/118: nix-env -qa --json: Generate valid JSON even if there are invali


From: Ludovic Courtès
Subject: 17/118: nix-env -qa --json: Generate valid JSON even if there are invalid meta attrs
Date: Tue, 19 May 2015 14:45:17 +0000

civodul pushed a commit to branch nix
in repository guix.

commit 3c6b8a521561f5341652ffe37b869d5ab457227b
Author: Eelco Dolstra <address@hidden>
Date:   Mon Jun 2 17:58:43 2014 +0200

    nix-env -qa --json: Generate valid JSON even if there are invalid meta attrs
---
 src/nix-env/nix-env.cc |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 2d38f2a..05f6aa3 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<DrvInfo> & 
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);
             }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]