| 494 | } |
| 495 | |
| 496 | struct command_result *command_finished(struct command *cmd, |
| 497 | struct json_stream *response) |
| 498 | { |
| 499 | assert(cmd->type == COMMAND_TYPE_NORMAL |
| 500 | || cmd->type == COMMAND_TYPE_HOOK |
| 501 | || cmd->type == COMMAND_TYPE_CHECK); |
| 502 | |
| 503 | /* Detach filter before it complains about closing object it never saw */ |
| 504 | if (cmd->filter) { |
| 505 | const char *err = json_stream_detach_filter(tmpctx, response); |
| 506 | if (err) |
| 507 | json_add_string(response, "warning_parameter_filter", |
| 508 | err); |
| 509 | } |
| 510 | |
| 511 | /* "result" or "error" object */ |
| 512 | json_object_end(response); |
| 513 | |
| 514 | return command_complete(cmd, response); |
| 515 | } |
| 516 | |
| 517 | struct command_result *command_finish_rawstr(struct command *cmd, |
| 518 | const char *json, |