JSON: add missing newlines

after `nix eval --json` and `nix-instantiate --eval --json`.
This commit is contained in:
Naïm Favier 2022-08-22 15:07:52 +02:00
parent 062e4fcdde
commit 4c2ff4a0f4
No known key found for this signature in database
GPG key ID: 95AFCE8211908325
2 changed files with 4 additions and 2 deletions

View file

@ -52,9 +52,10 @@ void processExpr(EvalState & state, const Strings & attrPaths,
state.autoCallFunction(autoArgs, v, vRes);
if (output == okXML)
printValueAsXML(state, strict, location, vRes, std::cout, context, noPos);
else if (output == okJSON)
else if (output == okJSON) {
printValueAsJSON(state, strict, vRes, v.determinePos(noPos), std::cout, context, false);
else {
std::cout << std::endl;
} else {
if (strict) state.forceValueDeep(vRes);
vRes.print(state.symbols, std::cout);
std::cout << std::endl;

View file

@ -117,6 +117,7 @@ struct CmdEval : MixJSON, InstallableCommand
else if (json) {
JSONPlaceholder jsonOut(std::cout);
printValueAsJSON(*state, true, *v, pos, jsonOut, context, false);
std::cout << std::endl;
}
else {