This closes a JSON response and writes it out. */
| 362 | |
| 363 | /* This closes a JSON response and writes it out. */ |
| 364 | static void finish_and_send_json(int fd, struct json_out *jout) |
| 365 | { |
| 366 | size_t len; |
| 367 | const char *p; |
| 368 | |
| 369 | json_out_end(jout, '}'); |
| 370 | /* We double-\n terminate. Don't need to, but it's more readable. */ |
| 371 | memcpy(json_out_direct(jout, 2), "\n\n", 2); |
| 372 | json_out_finished(jout); |
| 373 | |
| 374 | p = json_out_contents(jout, &len); |
| 375 | write_all(fd, p, len); |
| 376 | json_out_consume(jout, len); |
| 377 | } |
| 378 | |
| 379 | /* str is raw JSON from RPC output. */ |
| 380 | static struct command_result *WARN_UNUSED_RESULT |
no test coverage detected