diff options
author | Naïm Favier <n@monade.li> | 2022-08-22 15:07:52 +0200 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2022-08-22 15:07:52 +0200 |
commit | 4c2ff4a0f4c2106d5792a87a1ba9ee1fd18c0e4b (patch) | |
tree | 7ae20096a5c0c0dcaf3a219966e30571ec268847 | |
parent | 062e4fcdde145ec6780df8d1002dc7380f6eb4bf (diff) |
JSON: add missing newlines
after `nix eval --json` and `nix-instantiate --eval --json`.
-rw-r--r-- | src/nix-instantiate/nix-instantiate.cc | 5 | ||||
-rw-r--r-- | src/nix/eval.cc | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index 6181d2190..80f35828c 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -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; diff --git a/src/nix/eval.cc b/src/nix/eval.cc index cc022ae43..ddd2790c6 100644 --- a/src/nix/eval.cc +++ b/src/nix/eval.cc @@ -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 { |