This closes a JSON response and writes it out. */
| 552 | |
| 553 | /* This closes a JSON response and writes it out. */ |
| 554 | static void finish_and_send_json(int fd, struct json_out *jout) |
| 555 | { |
| 556 | size_t len; |
| 557 | const char *p; |
| 558 | |
| 559 | json_out_end(jout, '}'); |
| 560 | /* We double-\n terminate. Don't need to, but it's more readable. */ |
| 561 | memcpy(json_out_direct(jout, 2), "\n\n", 2); |
| 562 | json_out_finished(jout); |
| 563 | |
| 564 | p = json_out_contents(jout, &len); |
| 565 | write_all(fd, p, len); |
| 566 | json_out_consume(jout, len); |
| 567 | } |
| 568 | |
| 569 | /* str is raw JSON from RPC output. */ |
| 570 | static struct command_result *WARN_UNUSED_RESULT |
no test coverage detected