| 357 | } |
| 358 | |
| 359 | void plugin_kill(struct plugin *plugin, enum log_level loglevel, |
| 360 | const char *fmt, ...) |
| 361 | { |
| 362 | va_list ap; |
| 363 | const char *msg; |
| 364 | |
| 365 | va_start(ap, fmt); |
| 366 | msg = tal_vfmt(tmpctx, fmt, ap); |
| 367 | va_end(ap); |
| 368 | |
| 369 | log_(plugin->log, loglevel, |
| 370 | NULL, loglevel >= LOG_UNUSUAL, |
| 371 | "Killing plugin: %s", msg); |
| 372 | kill(plugin->pid, SIGKILL); |
| 373 | if (plugin->start_cmd) { |
| 374 | plugin_cmd_killed(plugin->start_cmd, plugin, msg); |
| 375 | plugin->start_cmd = NULL; |
| 376 | } |
| 377 | |
| 378 | /* Don't come back when we free stdout_conn! */ |
| 379 | io_set_finish(plugin->stdout_conn, NULL, NULL); |
| 380 | tal_free(plugin); |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * Send a JSON-RPC message (request or notification) to the plugin. |
no test coverage detected