* Called when trying to start a plugin through RPC, it starts the plugin and * will give a result 60 seconds later at the most (once init completes). */
| 63 | * will give a result 60 seconds later at the most (once init completes). |
| 64 | */ |
| 65 | static struct command_result * |
| 66 | plugin_dynamic_start(struct plugin_command *pcmd, const char *plugin_path, |
| 67 | const char *buffer, const jsmntok_t *params) |
| 68 | { |
| 69 | struct plugin *p = plugin_register(pcmd->cmd->ld->plugins, plugin_path, pcmd, false, buffer, params); |
| 70 | const char *err; |
| 71 | |
| 72 | if (!p) |
| 73 | return command_fail(pcmd->cmd, JSONRPC2_INVALID_PARAMS, |
| 74 | "%s: %s", plugin_path, |
| 75 | errno ? strerror(errno) : "already registered"); |
| 76 | |
| 77 | /* This will come back via plugin_cmd_killed or plugin_cmd_succeeded */ |
| 78 | err = plugin_send_getmanifest(p, pcmd->cmd->id); |
| 79 | if (err) |
| 80 | return command_fail(pcmd->cmd, PLUGIN_ERROR, |
| 81 | "%s: %s", |
| 82 | plugin_path, err); |
| 83 | |
| 84 | return command_still_pending(pcmd->cmd); |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Called when trying to start a plugin directory through RPC, it registers |
no test coverage detected