nix-env -qa --json: Generate valid JSON even if there are invalid meta attrs
This commit is contained in:
parent
ceed819284
commit
3c6b8a5215
1 changed files with 3 additions and 2 deletions
|
@ -882,9 +882,10 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems)
|
||||||
foreach (StringSet::iterator, j, metaNames) {
|
foreach (StringSet::iterator, j, metaNames) {
|
||||||
metaObj.attr(*j);
|
metaObj.attr(*j);
|
||||||
Value * v = i->queryMeta(*j);
|
Value * v = i->queryMeta(*j);
|
||||||
if (!v)
|
if (!v) {
|
||||||
printMsg(lvlError, format("derivation `%1%' has invalid meta attribute `%2%'") % i->name % *j);
|
printMsg(lvlError, format("derivation `%1%' has invalid meta attribute `%2%'") % i->name % *j);
|
||||||
else {
|
cout << "null";
|
||||||
|
} else {
|
||||||
PathSet context;
|
PathSet context;
|
||||||
printValueAsJSON(globals.state, true, *v, cout, context);
|
printValueAsJSON(globals.state, true, *v, cout, context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue